Demonstrate running Mac Catalyst with AppKit plugin bundle
We would like to include some natvie Mac experiences (e.g. NSWindow, Menu Bar Extra) while building Catalyst-based app.
- In order to use AppKit components, we learn to include a plugin target which builds on Cocoa framework.
- We also want to use CocoaPods to include 3rd-party frameworks
- Some UI-related frameworks use alias to share features
- DynamicColor (UIColor vs NSColor)
- BonMot (UIFont vs NSFont)
- PinLayout (UIView vs NSView)
- These frameworks use corresponding classes when included in iOS or macOS based apps.
- For hosting app using Catalyst, it should pick UIKit related system frameworks like UIKit
- For plugin, it should pick AppKit related system frameworks like Cocoa
- While running the plugin with frameworks, the app crashes
- It shows
Symbol not found
with other console error messages - For example, in the case of
DynamicColor
, it tells thatNSColor
or aliasDynamicColor
is not found
- Run
pod install
to install the frameworks using CocoaPods - Open the workspace using the workspace file
FirstViewController
runs the UIKit Catalyst codesSecondViewController
runs the plugin code which attempts to load symbols from frameworks
If I import the framework source codes to the plugin by manually copying them, these codes can be built flaslessly under Cocoa environment.