Skip to content

IOS embed a dynamic framework xcode project changes#1944

Open
lcsatchell wants to merge 1 commit intoopenfl:developfrom
Goose-Git:ios-embed-dynamic-framework
Open

IOS embed a dynamic framework xcode project changes#1944
lcsatchell wants to merge 1 commit intoopenfl:developfrom
Goose-Git:ios-embed-dynamic-framework

Conversation

@lcsatchell
Copy link
Copy Markdown

This pull request updates the generated Xcode project when using embed=true with an iOS framework dependency.
Specifically, it:
Adds a "Copy Files" build phase
Updates the Runpath Search Paths

These changes ensure that dynamic framework dependencies are correctly embedded and included in the final app bundle.
Note: You’ll need to rebuild Lime tools after applying these changes.

Why this is needed:
Dynamic frameworks aren’t automatically embedded in the same way static frameworks are. This becomes particularly important when working with Swift code, which must be included in a dynamic framework.

Use case:
To include Swift code in an extension, it was added to a custom dynamic framework. That framework was then included in the extension using embed=true. Without these changes, the framework wouldn't be properly compiled into the app.

When including a dynamic framework for ios as a dependency with embed="true", adds the necessary copy files build phase and runpath searchpath to the xcode project to ensure the framework is compiled into your app. You will need to rebuild lime tools after making hte change.
Comment on lines +44 to +46
/* Begin PBXCopyFilesBuildPhase section */
::ADDL_PBX_COPY_FILES_BUILD_PHASE::
/* End PBXCopyFilesBuildPhase section */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a null check here, like:

::if (ADDL_PBX_COPY_FILES_BUILD_PHASE != null)::
::ADDL_PBX_COPY_FILES_BUILD_PHASE::
::end::

because if you try to use this pbxproj template without having the build tools updated and rebuilt, you get the following:

/ Begin PBXCopyFilesBuildPhase section /
null
/ End PBXCopyFilesBuildPhase section /

That results in a corrupted pbxproj file

Copy link
Copy Markdown

@IriySoft IriySoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to add checks in case the project template will be used in the environment that adopts frameworks embedding patch and then someone will try to use the same template in the environment that doesn't.

GCC_PREFIX_HEADER = "::APP_FILE::/::APP_FILE::-Prefix.pch";
INFOPLIST_FILE = "::APP_FILE::/::APP_FILE::-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = ::DEPLOYMENT::;
::ADDL_PBX_RUNPATH_SEARCH_PATHS::
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

::if(ADDL_PBX_RUNPATH_SEARCH_PATHS != null)::::ADDL_PBX_RUNPATH_SEARCH_PATHS::::end::

@player-03
Copy link
Copy Markdown
Contributor

Are people really going to use this template without also updating the build tools?

@IriySoft
Copy link
Copy Markdown

Are people really going to use this template without also updating the build tools?

Well…. The short answer is no :)

I had to copy the project template to the extension that I’m making and got these build errors when switching Lime versions. And I thought that the extensions should at least build without errors if someone tries to use it with the current Lome, because I don’t know if the pull request ends up accepted. But I added these null checks to my template copy so you’re right, these null checks are redundant in the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants