1

I have a question about Xcode. I'm trying to create an App for all Apple Platforms. IOS, MacOS, WatchOS and TVOS. I know how to set up a Multiplatform app but the problem I am facing right now is how I separate the iPhone and iPad App to meet apples preferred iPadOS design expectations like a sidebar or something. Do I have to set it up in Code or in Xcode and how?

pawello2222
  • 46,897
  • 22
  • 145
  • 209
Rob
  • 125
  • 1
  • 1
  • 7
  • 1
    Does this answer your question? [How to detect current device using SwiftUI?](https://stackoverflow.com/questions/61113923/how-to-detect-current-device-using-swiftui) – Joakim Danielson Feb 20 '21 at 13:41

1 Answers1

2

You can check the current device and then change the interface depending on if your user uses an iPhone or iPad.

To check if it is an iPad, use

if UIDevice.current.userInterfaceIdiom == .pad { }

Just replace the .pad with .phone to check for an iPhone.

J--
  • 172
  • 1
  • 14