简体   繁体   中英

How to use Realm in both iOS and macOS projects of one workspace

I'm trying to figure out how to use Realm in both projects iOS and macOS of a single workspace. At first try it fails to compile with more than 200 errors.

Workspace currently contains:

  • MyApp iOS project
  • MyAppMac macOS project
  • Pods project

Podfile:

workspace 'MyApp'

target 'MyApp' do

    workspace 'MyApp'
    xcodeproj 'MyApp.xcodeproj'

    use_frameworks!

    pod 'RealmSwift'
    pod 'SVProgressHUD'

end

target 'MyAppMac' do

    workspace 'MyApp'
    xcodeproj 'MyAppMac.xcodeproj'

    use_frameworks!

    pod 'RealmSwift'

end

I just discovered that adding pod 'Realm' to MyAppMac target, works fine and produces no errors.

However, is this optimal?

I've seen some ways to reuse shared pods like RealmSwift but not sure how to do this given the configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM