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

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

--

--

--

 WWDC Award Winner | Software Engineer, Github Developer, UI/UX Design | Contact: hi@1998.media | Website: 1998.media

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

iOS UI development bad things vs Android

The Three Most Basic Job Interview Details that Rookie iOS Developers ignore, which could lead to…

Gratitude Widgets

Snapshot Testing. Testing the UI and Beyond (Part 3)

How to Change a Publisher’s Failure Type in Combine

Data Binding with MVVM on iOS part 1: Data flows

Firebase Crashlytics for multiple targets in an iOS app

Try on a new style — Build an iOS app to change your hair color with Fritz Hair Segmentation

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
MING

MING

 WWDC Award Winner | Software Engineer, Github Developer, UI/UX Design | Contact: hi@1998.media | Website: 1998.media

More from Medium

Embed UIView in SwiftUI, define communication both ways

How To: Save Contacts on SwiftUI

IOS DEVELOPMENT MADE EASY

How to Implement Universal Link in SwiftUI App