utility methods for swift