I have basically two frameworks running on Xcode. "ResearchKit" and "AppMethods". While all works fine, the "AppMethods" framework utilizes code within "ResearchKit". In fact it is there to abstract out more methods into framework. A superclass of sorts.
When using them in code, I have to import both frameworks
import ResearchKit
import AppMethods
Is there a way to embed ResearchKit within AppMethods such that I only need to import AppMethods
. Without ResearchKit
, AppMethods
would not exist.
2
Answers
It really depends on the way you implement and use these frameworks within the app.
Generally speaking, iOS doesn’t support nested frameworks – please read the follwoing.
But imports can be done within each framework – i.e you can import
ResearchKit
directly fromAppMethods
and just "tell" Xcode that the code will be there on compile time, you will have to link the frameworks within the App level. Another useful guide I foundIt is quite simple to achieve with CoacoaPods and SPM
Your "stack" is this:
Within your classes in the app, where you dont explicitly call a RK API (class or method) you dont have to import RK. Otherwise, you have to import RK.
Please note you can embed one library inside another (in this case RK inside AM), and maybe make sure that nobody outside AM knows anything about RK. But once you start explicitly calling RK api within your app, there is no other way than importing RK explicitly along AM.