code snippets for iOS