Sharing code between original iOS App and App Extension

Ruben Martinez Jr. picture Ruben Martinez Jr. · Mar 1, 2015 · Viewed 15.7k times · Source

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.

Answer

Avt picture Avt · Mar 1, 2015

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

enter image description here