Using Cocoapods one target multiple platforms

Viewed 1600

I want to try to get Firebase SDK working for both iOS and macOS app using the new Apple Catalyst project (porting iOS app to macOS).

I've already setup my Xcode project with Cocoapods and it's working fine using this pod file:

platform :ios, '11.0'

abstract_target 'SharedPods' do
    use_frameworks!
    pod 'Perform'
    pod 'Nuke', '~> 7.6.1'
    pod 'PureLayout'
    pod 'DeviceKit', '~> 2.0'
    pod 'lottie-ios'
    pod 'Highlightr'
    pod 'Firebase/Core'
    pod 'Firebase/Database'
    pod 'Firebase/Auth'
    pod 'Fabric'
    pod 'Crashlytics'
    pod 'GoogleAPIClientForREST/Sheets'
    pod 'GoogleSignIn'
    pod 'SwiftLint'

    target 'xxxxx-app' do
    end

    target 'xxxxx' do
    end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
     target.build_configurations.each do |config|
        config.build_settings['LD_NO_PIE'] = 'NO'
     end
  end
end

However, how do I add so that it builds for macOS as well using the same target (xxxxx-app in pod file).

1 Answers

Developing Firebase with Catalyst

Install Catalina and Xcode 11.

For each podspec in https://github.com/firebase/firebase-ios-sdk, run

  • pod gen {name here}.podspec --local-sources=./ --auto-open
  • Check the Mac box in the App-iOS Build Settings
  • Sign the App in the Settings Signing & Capabilities tab
  • Click Pods in the Project Manager
  • Add Signing to the iOS host app and unit test targets
  • Select the Unit-unit scheme
  • Run it to build and test

Source: https://github.com/firebase/firebase-ios-sdk/issues/3144#issuecomment-520530306

Related