SwiftUI on different devices

Hi all, I just finished watching all the WWDC sessions on SwiftUI, and I'm super excited to get started working with it. Before starting my first SwiftUI app though, I realized they never really showed how to build for multiple devices in the WWDC sessions. Does anyone know the best practice for this? Essentially what I'm asking is lets say I want to build the Landmarks app they demoed. I want to build macOS, tvOS, and iOS versions. How would I develop this app to use similar source code for all platforms? Would I write all the platform files in one Xcode project or separate? If in one, how do you decide which one to build and preview in Xcode at a certain time? And most importantly how do you tell App Store Connect which file is associated with which platform? Any help is appreciated. Thanks

Accepted Reply

>How would I develop this app to use similar source code for all platforms?


At the present time, if you mean one project, I'd suggest using multiple targets. You then select that target when testing/building/submitting to the store. But that's just me. Depending on your style, you may prefer separate projects. You might want to experiment and see which workflow suits you the best.


As for ASC, the bifurcation process begins when you add a new app. As you progress thru the submittal process, the store quietly lines things up in the background. All you have to tell it is which app you're working with a given moment in time.


See App Store Connect Help

Replies

>How would I develop this app to use similar source code for all platforms?


At the present time, if you mean one project, I'd suggest using multiple targets. You then select that target when testing/building/submitting to the store. But that's just me. Depending on your style, you may prefer separate projects. You might want to experiment and see which workflow suits you the best.


As for ASC, the bifurcation process begins when you add a new app. As you progress thru the submittal process, the store quietly lines things up in the background. All you have to tell it is which app you're working with a given moment in time.


See App Store Connect Help