In an iOS or OS X Framework, which contains common code for both its App, and app Extensions, is there a way to detect if the code is being run under the main app, or one of its extensions? Specifically I'd like to detect if the framework is being used as part of a WatchKit extension as opposed to within the iPhone part of the App.
UIDevice.currentDevice
always returns the iPhone as that is what is running the code. I believe I could check if WKInterfaceDevice
exists, but that doesn't seem too elegant.