skip to Main Content

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


  1. 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 from AppMethods 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 found

    It is quite simple to achieve with CoacoaPods and SPM

    Login or Signup to reply.
  2. Your "stack" is this:

    App
    |
    AppMethods (AM for short)
    |
    ResearchKit (RK for short).
    

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search