Swift utility functions