Multiplatform development questions

I've been planning an iOS app for some time which uses SwiftData and will be subscription based, and have done some development work on it. But now I'm wondering if I should also do a MacOS version, and that got me wondering if it's possible to do a multiplatform version? I've done searching, and can't find much info on such development. So my qestions are...

  1. If I choose multiplatform in Xcode, do I just make one version of the code, and the API will know what platform it's on automatically?
  2. Does SwiftData also work on MacOS?
  3. Would I setup the same subscription to work on the iOS app store and the Mac app store? I'm planning on using RevenueCat. Or would subscriptions in both stores be completely seperate?
  4. Are there some things that are just not compatible between the platforms that I should be aware of?
  5. Is it just better to do 2 different xcode projects, despite the large amount of code overlap?
Accepted Answer

Answers to the specific questions.

  1. If you use SwiftUI, you might be able to have just one version of the code with a multiplatform app target. But there is a good chance you will need to build separate iOS and Mac user interface code in some places to provide the best experience on both platforms.
  2. SwiftData works on Mac, but it requires macOS 14, which is not out yet.
  3. I have not used RevenueCat, but you have to ask yourself if you want people who buy a subscription to get both versions with the subscription. If so, you can have one subscription that works on both platforms. If not, you need separate subscriptions.
  4. Renaming, moving, and deleting list items has a lot of differences. If your app does those things, you will need to create separate list code for iOS and Mac.
  5. Stick with one Xcode project. Either use the multiplatform app target or create separate targets for iOS and Mac.

The following article has more information about multiplatform app targets:

https://www.swiftdevjournal.com/xcode-multiplatform-app-targets/

I agree with most of what szymczyk answered above.

Here are a few little tips I've learned while building a multi-platform app for several months.

  • If you used UIKit functions, you need to customize them for AppKit. (UIImage, UIApplication, UIColor)

  • Since fullScreenCover is not supported on macOS, it is best to use sheet if possible.

  • When using lists on macOS, it looks better to use .formStyle(.grouped).

  • Depending on the version of macOS, if there is a problem with the list in the Form not scrolling, it must be wrapped in a ScrollView. No problem in the latest version

  • You need to create a routine that corresponds to iOS' swipe action.

  • You will need to modify routines related to keyboard input. (keyboardType, keyDown)

  • If you have already created a UI for iPad landscape mode, I think you will be able to easily create an app for macOS. Even if the UI is created with the same code, testing must be done separately. In particular, there were many small bugs in NavigationSplitView on the iPad, and Apple has neglected them for a long time.

Multiplatform development questions
 
 
Q