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...
- 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?
- Does SwiftData also work on MacOS?
- 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?
- Are there some things that are just not compatible between the platforms that I should be aware of?
- Is it just better to do 2 different xcode projects, despite the large amount of code overlap?
Answers to the specific questions.
- 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.
- SwiftData works on Mac, but it requires macOS 14, which is not out yet.
- 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.
- 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.
- 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/