Skip to content

Instantly share code, notes, and snippets.

@below
Created April 4, 2018 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save below/f51c20d6242c0f22122223a54636df5b to your computer and use it in GitHub Desktop.
Save below/f51c20d6242c0f22122223a54636df5b to your computer and use it in GitHub Desktop.
Watch Development Question
**** Hokay ****
I have an existing project, which includes a Watch App. The main App and the Watch extension share some code.
Now (for reasons I will gladly explain but I ask you so simply presume as valid for now) some code is moving into a framework.
The shared code in the App and in the Extension is depending on (i.e. using) the code in the Framework.
Said Framework should be different for the App and the Watch (i.e. it must show different behavior), this is why don't want to build a universal Framework (I don't even know if that is possible). For simplicity however, the Pricipal Class of both Frameworks should be the same, so that the shared code in the App and the Watch can access the Framework the same way.
The big external difference now is the Framework name: `MyFramework.framework` vs. `MyFramework-watch.framework`. The build system doesn't easily let me build two frameworks of the same name in the same projekt, and I guess that makes sense.
***** The Question! *****
Now, should I jump through hoops (creating a different project et al) to create two frameworks with the same name?
Or should I simply use:
`#if TARGET_OS_WATCH
  #import <MyFramework-Watch/MyFramework-Watch.h>
#else
  #import <MyFramework/MyFramework.h>
#endif`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment