In WatchKit, you have an application that works on your phone, and a watch application that works as an extension.
If you are creating a library containing a common code that will be used both in the phone application and in the watch extension, is there a way to find out if the code works in the phone application or chat extension?
those.
if ([self isRunningInWatchExtension]) { NSLog(@"this is running on watch"); } else { NSLog(@"this is running on phone app"); } - (BOOL)isRunningInWatchExtension { ??? }
source share