Hi everyone,
I'm studying Mergeable libraries. (in an iOS platform)
In general, with the knowledge I knew (may not be accurate), Static Library cannot use resources except to add a separate resource bundle to the Main App Target, so I understand that the main app uses dynamic library.
But In "Meet mergeable libraries Session", it was said that below "Up until iOS 12, the runtime needed the framework's binary to discover bundles, but mergeable frameworks won't have binaries in them by the time the process is running. Good news! In iOS 12, a hook was added to enable lookup for this scenario. That does mean if you rely on bundle lookup support, you should update your minimum deployment version to iOS 12 or later to use mergeable libraries."
I don't know what 'hook' is mentioned below.
I have a dynamic library that only handles the resources(images, colors - xcassets) and those assets compiled and become Assets.car file
I set Build Mergeable Library
to Yes
in the build setting of this dynamic library, and I set Create Mergeable Binary
to Automatic
in the Main App (which relies on this library).
When the app bundle includes the framework, of course the resource is loaded, but if I set the library to do not embedded in the project setting, I cannot read the resource.
I wonder if the Merged Binary (Main App) has a library merged, and if I need to add a separate framework to the App Bundle simply because of resources.
Thank you.
it takes advantage of static linking
Yes.
but I think the bundle size for the app will be bigger
No. The Mach-O image for the framework (Test736404.app/Contents/Frameworks/FFF1.framework/Versions/A/FFF1
) is effectively empty. The code that would normally be there has been statically linked into the app itself (Test736404.app/Contents/MacOS/Test736404
). So, the framework exists on disk as:
-
An empty Mach-O image
-
A file system hierarchy containing your resources
The first won’t significantly increase the size of your app and the second is required.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"