Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    ios – How can I dynamically load xcframeworks only when they are used, not at the start of the app?

    May 14, 2026

    West Pharmaceutical says hackers stole data, encrypted systems

    May 14, 2026

    Our Path Forward – Cisco Blogs

    May 13, 2026
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    Home»iOS Development»ios – How can I dynamically load xcframeworks only when they are used, not at the start of the app?
    iOS Development

    ios – How can I dynamically load xcframeworks only when they are used, not at the start of the app?

    big tee tech hubBy big tee tech hubMay 14, 2026002 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    ios – How can I dynamically load xcframeworks only when they are used, not at the start of the app?
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    I am distributing a proprietary iOS SDK as a binary xcframework. The SDK includes some features that require other, external dependencies (also xcframeworks) to work.

    The external dependencies are quite large in size, and not many SDK clients use the features that require them. So we decided to distribute a version of the SDK that does not include those features that require those big dependencies. Right now, this is controlled by a compilation flag, e.g.

    #if EXTERNAL_DEPENDENCY
    import SomeDependency
    #endif
    
    class SomeSDKComponent {
    
        // ... other code
    
    #if EXTERNAL_DEPENDENCY
        func thisMethodUsesTheExternalDependencies() { ... }
    #endif
    
        // ... other code
    }
    

    If the SDK client wants to use the features that require those external dependencies, we’d build the SDK with the EXTERNAL_DEPENDENCY turned on.

    In Xcode, these dependencies are set to “Do Not Embed”, so that the size of the xcframework stays small, and we distribute the dependencies separately if the client needs them.

    enter image description here


    While this works, I would great if I can remove the compilation flag.

    That is, I want to be able to compile the SDK without all the #ifs:

    import SomeDependency
    
    class SomeSDKComponent {
    
        // ... other code
    
        func thisMethodUsesTheExternalDependencies() { ... }
    
        // ... other code
    }
    

    and I expect 3 things:

    • if the client never uses thisMethodUsesTheExternalDependencies, their app should work regardless of whether they included the external dependencies or not.
    • if the client calls thisMethodUsesTheExternalDependencies, and includes the external dependencies, their app should work as expected.
    • if the client calls thisMethodUsesTheExternalDependencies, but does not include the external dependencies, their app should crash when the call is made.

    How can I do this?

    If I simply remove the #ifs, the client app will crash immediately after launch if they don’t include the external dependencies. The error says

    dyld[48209]: Library not loaded: @rpath/ExternalDependency.framework/ExternalDependency
      Referenced from: <9F14FB92-BA4C-31E7-A4C9-7C04941377AA> /private/var/containers/Bundle/Application/D81D65F6-81C5-4696-B1BD-854B39473EB2/ClientApp.app/Frameworks/MyProprietarySDK.framework/MyProprietarySDK
    

    …followed by a list of paths that it tried to search for.

    So it seems like the app always tries to load these libraries upon launch.

    Since the external dependencies are dynamically linked, my understanding is that the linking can theoretically happen when the first time thisMethodUsesTheExternalDependencies is called, instead of at the start of the app. Is there a build setting for this?



    Source link

    app dynamically iOS load Start xcframeworks
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    ios – How to achieve the UI of the search tab in the App Store in Swift?

    May 13, 2026

    ios – How to add shadow to border?

    May 12, 2026

    My Outer Loop | Cocoanetics

    May 11, 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    ios – How can I dynamically load xcframeworks only when they are used, not at the start of the app?

    May 14, 2026

    West Pharmaceutical says hackers stole data, encrypted systems

    May 14, 2026

    Our Path Forward – Cisco Blogs

    May 13, 2026

    Ryan Carson Is a One-Person Code Factory – O’Reilly

    May 13, 2026
    Timer Code
    15 Second Timer for Articles
    20
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    ios – How can I dynamically load xcframeworks only when they are used, not at the start of the app?

    May 14, 2026

    West Pharmaceutical says hackers stole data, encrypted systems

    May 14, 2026

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2026 bigteetechhub.All Right Reserved

      Type above and press Enter to search. Press Esc to cancel.