Handling App Extension Code
Over the past couple of years, Apple has been slowly increasing the number and kinds of App Extensions one can associate with their applications. As such, reusing code between a main application and an extension is somewhat desireable. At the most basic level, adding a logic branch to a path is crude, but effective: if ([NSBundle.mainBundle.bundlePath hasSuffix:@".appex"]) { // Do app extension stuff } else { // Do main app stuff } Unfortunately, this does not handle the case where the main application branch references APIs that are unavailable in app extensions....