iosxcodeios-app-extensionios8-extension

Sharing code between original iOS App and App Extension


Sharing class between iOS app and extension app

I want to use a custom class in both my app and the extension app. If I just have the class in the main app folder, the extension doesn't pick up on it. I tried making a copy of it and putting it into the extension folder, but I of course get a invalid redeclaration of [my class] error. What's the best solution for this? It's just one class, not multiple resources.


Solution

  • Nothing should be copied. Just add required files to compile sources for your extension:

    enter image description here