How to create different layout for iPad and iPhone?

In the session said that "Design apps specifically for iPad" How do I implementing this?

For example the calendar app. It has a different UI for the iPad and iPhone landscape mode. How can I do this? Do I need to check the size class for both width and height then display a different view?

Accepted Reply

Generally you should use horizontal and vertical size classes to specialize how much detail your interface can display. If you support compact widths for iPhone, you now support iPad in slide-over and split view. If you support regular widths you now support iPad apps in full screen (and Mac if you choose to deploy on Mac via Mac Catalyst or as a SwiftUI app target). How you handle changing your UI between these size classes is up to you and your app.

It's totally reasonable to supply different views for different environment values, and you can continue to utilize the same data models to drive your interface. For an example that highlights building an app for iPhone, iPad, and Mac, check out the Fruta sample code project.
https://developer.apple.com/documentation/swiftui/fruta_building_a_feature-rich_app_with_swiftui

You can see in a couple key areas where views are swapped out based on horizontal size class on iOS, specifically in SmoothieHeaderView.swift and ContentView.swift

Replies

Generally you should use horizontal and vertical size classes to specialize how much detail your interface can display. If you support compact widths for iPhone, you now support iPad in slide-over and split view. If you support regular widths you now support iPad apps in full screen (and Mac if you choose to deploy on Mac via Mac Catalyst or as a SwiftUI app target). How you handle changing your UI between these size classes is up to you and your app.

It's totally reasonable to supply different views for different environment values, and you can continue to utilize the same data models to drive your interface. For an example that highlights building an app for iPhone, iPad, and Mac, check out the Fruta sample code project.
https://developer.apple.com/documentation/swiftui/fruta_building_a_feature-rich_app_with_swiftui

You can see in a couple key areas where views are swapped out based on horizontal size class on iOS, specifically in SmoothieHeaderView.swift and ContentView.swift
The session "Build for iPad" was quite good and covered this topic. Thanks for posting that Fruta sample code.