Porting apps to mac is finally possible thanks to Catalyst, problem is, numerous pods don\'t support AppKit. Most common one would be Crashlytics / Firebase
Based on what has already been discussed here... here is my solution for projects with multiple targets. It basically is validating the usage of the libs on each target instead of following the target name.
post_install do |installer|
installer.pods_project.targets.each do |target|
# handle non catalyst libs
libs = ["FirebaseAnalytics", "Google-Mobile-Ads-SDK"]
target.build_configurations.each do |config|
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
values = ""
libs.each { |lib|
if xcconfig["-framework \"#{lib}\""]
puts "Found '#{lib}' on target '#{target.name}'"
xcconfig.sub!(" -framework \"#{lib}\"", '')
values += " -framework \"#{lib}\""
end
}
if values.length > 0
puts "Preparing '#{target.name}' for Catalyst\n\n"
new_xcconfig = xcconfig + 'OTHER_LDFLAGS[sdk=iphone*] = $(inherited)' + values
File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
end
end
end
end
It outputs something like this
Generating Pods project
Found 'Google-Mobile-Ads-SDK' on target 'Pods-TheApp'
Found 'FirebaseAnalytics' on target 'Pods-TheApp'
Preparing 'Pods-TheApp' for Catalyst
Found 'Google-Mobile-Ads-SDK' on target 'Pods-TheApp-TheAppTests'
Found 'FirebaseAnalytics' on target 'Pods-TheApp-TheAppTests'
Preparing 'Pods-TheApp-TheAppTests' for Catalyst
Found 'Google-Mobile-Ads-SDK' on target 'Pods-TheApp-TheApp_iOS_UI_Tests'
Found 'FirebaseAnalytics' on target 'Pods-TheApp-TheApp_iOS_UI_Tests'
Preparing 'Pods-TheApp-TheApp_iOS_UI_Tests' for Catalyst
Found 'Google-Mobile-Ads-SDK' on target 'Pods-TheAppIntentsExtension'
Found 'FirebaseAnalytics' on target 'Pods-TheAppIntentsExtension'
Preparing 'Pods-TheAppIntentsExtension' for Catalyst
Found 'Google-Mobile-Ads-SDK' on target 'Pods-TheAppTodayExtension'
Found 'FirebaseAnalytics' on target 'Pods-TheAppTodayExtension'
Preparing 'Pods-TheAppTodayExtension' for Catalyst