Creating the macOS version of the app with a new target
Our iOS app showed a list of insects in one view and details regarding the selected insect in a separate view, because of the limited amount of space available on the iPhone screen. However, a Mac screen has a larger amount of screen space; therefore, we can display the list of insects on the left side of the screen and the details regarding the selected insect on the right side.
In this recipe, we will create a new target for our macOS app and share code and resources between the two targets, iOS and macOS. This approach is best suited if one of the following applies:
- Your app has a considerably different user interface between the Mac and the iPhone.
- Your app has a large legacy code base in UIKit and AppKit.
- You have two separate apps and want to share code and resources between them.
- You need to support versions of iOS older than iOS 16 and you can’t use the new multiplatform views...