Multi Platform App

Hi,

Suppose I want to create an School management App that have little complex views so I need a three versions of each view one for Mac and one for iPadOS and one for iOS, cause using platform detector on same view and adjusting layout will make things messy. So what's the best way to achieve that ? Separate project to each platform ? maybe Targets which I still don't understand cause modifying a view in any target will be reflected to other targets so what's the best practice here ? Im working with SwiftUI

Kind Regards

Answered by szymczyk in 820454022

Xcode has a multi-platform app project template that gives you one app target with destinations for iOS, iPad, and Mac. Use this template if you want people to have access to all three versions with one purchase. Create separate targets if you want to require separate purchases to access each person.

Regarding the views, if you have separate targets, you can create view files that apply to a specific target. A Mac version of the view would be part of the Mac app target but not the iOS version.

If you go with the multiplatform-app template, you can create view files that apply to only one platform. Go to the target's Compile Sources build phases and specify the platforms to build for. More details about the multi-platform app template are in the following article:

swiftdevjournal.com/xcode-multiplatform-app-targets/

Accepted Answer

Xcode has a multi-platform app project template that gives you one app target with destinations for iOS, iPad, and Mac. Use this template if you want people to have access to all three versions with one purchase. Create separate targets if you want to require separate purchases to access each person.

Regarding the views, if you have separate targets, you can create view files that apply to a specific target. A Mac version of the view would be part of the Mac app target but not the iOS version.

If you go with the multiplatform-app template, you can create view files that apply to only one platform. Go to the target's Compile Sources build phases and specify the platforms to build for. More details about the multi-platform app template are in the following article:

swiftdevjournal.com/xcode-multiplatform-app-targets/

@szymczyk Thanks allot, that was very helpful.

Kind Regards

Multi Platform App
 
 
Q