trinhngocthuyen / cocoapods-spm

A CocoaPods plugin to add SPM dependencies to CocoaPods-based projects
MIT License
35 stars 7 forks source link

FEAT: Option to use default Xcode linking (ie. adding products to "Link Binary With Libraries") #69

Closed trinhngocthuyen closed 2 months ago

trinhngocthuyen commented 2 months ago

This PR introduces the option to fall back to the default Xcode linking, ie. adding products to the "Link Binary With Libraries" section.

Use this option by:

spm_pkg ...
        :linking => {
          :use_default_xcode_linking => true, # <-- HERE
        }

NOTE: We might get the "duplicate symbols" error when building the project. This issue happens when having the -ObjC flag in the linking process. A workaround to fix it is to specify the -ld64 option (mentioned here). This can be done by using the :linker_flags nested inside in :linking option.

spm_pkg ...
        :linking => {
          :use_default_xcode_linking => true, # <-- HERE
          :linker_flags => ["-ld64"], # <-- HERE
        }