Upgrade to Pro — share decks privately, control downloads, hide ads and more …

All about linking libraries

All about linking libraries

All about linking libraries - How to solve import/link errors-
- Anatomy of linking libraries or frameworks
- Anatomy: importing libraries or frameworks

Kishikawa Katsumi

March 22, 2019
Tweet

More Decks by Kishikawa Katsumi

Other Decks in Technology

Transcript

  1. Dynamic vs Static w/ Bundle vs wo/Bundle Static Library (*.a)

    Static Framework (*.framework) Dynamic Framework (*.framework) Dynamic Library (*.dylib)
  2. with Bundle without Bundle Static Linking Dynamic Linking Dynamic vs

    Static w/ Bundle vs wo/Bundle Static Library Static Framework Dynamic Library Dynamic Framework
  3. How to make available external frameworks/libraries in Swift • Import

    the framework/library from your app or framework • Link the framework/library to your app or framework
  4. How to import frameworks • Does the framework has modules?

    Yes: => Set parent directory of the framework to Framework Search Paths
  5. How to import frameworks • Does the framework has modules?

    No: • Do you try to import the framework to your app? Yes: => a) Create module map. b) Create bridging header. No: => Create module map.
  6. How to link frameworks • Is the framework dynamic framework?

    Yes: => Copy the framework into the app bundle => Set parent directory of the framework to Framework Search Paths => Set -framework <FRAMEWORK_NAME> to Other Linker Flags No: => Set parent directory of the framework to Framework Search Paths => Set -framework <FRAMEWORK_NAME> to Other Linker Flags e.g.) -framework KeychainAccess
  7. How to link libraries • Is the library dynamic library?

    Yes: => Set parent directory of the framework to Library Search Paths => Copy the library into the app bundle No: => Set parent directory of the framework to Library Search Paths => Set -l<LIBRARY_NAME> to Other Linker Flags e.g.) -lwebpdecoder
  8. Recap • The processes of making external libraries available in

    the Swift project. => Import and Linking • Errors on importing => Module maps, Framework/Library Search Paths, Import Paths • Errors on linking => Module maps, Framework/Library Search Paths, Static or Dynamic • Errors on runtime => "Copy Files" Build phase