Shared code for Mac OS X and iOS