How to: Build A Cross-Platform App with SwiftUI 2

Let me show you how to build a simple app that works on iOS, iPadOS, and macOS…

Image: developer.apple.com

How to know the device is running iOS / macOS?

We can use:

#if os(iOS) //For iPhone/iPad
#elseif os(macOS) //For Mac