How can I change the size of a sheet on iPad in SwiftUI
Asked on 07/31/2024
1 search
To change the size of a sheet on iPad in SwiftUI, you can use the new presentation sizing modifier introduced in the latest updates. This modifier allows you to create perfectly sized sheets with form or page, or even use custom sizing.
For more details, you can refer to the session What’s new in SwiftUI at the timestamp 02:22.
Here is a brief example of how you might use the presentation sizing modifier in SwiftUI:
.sheet(isPresented: $isSheetPresented) {
MySheetView()
.presentationDetents([.medium, .large])
.presentationDragIndicator(.visible)
}
In this example, .presentationDetents([.medium, .large])
specifies the sizes that the sheet can adopt. You can customize these detents to fit your specific needs.

SwiftUI essentials
Join us on a tour of SwiftUI, Apple’s declarative user interface framework. Learn essential concepts for building apps in SwiftUI, like views, state variables, and layout. Discover the breadth of APIs for building fully featured experiences and crafting unique custom components. Whether you’re brand new to SwiftUI or an experienced developer, you’ll learn how to take advantage of what SwiftUI has to offer when building great apps.

Dive deep into volumes and immersive spaces
Discover powerful new ways to customize volumes and immersive spaces in visionOS. Learn to fine-tune how volumes resize and respond to people moving around them. Make volumes and immersive spaces interact through the power of coordinate conversions. Find out how to make your app react when people adjust immersion with the Digital Crown, and use a surrounding effect to dynamically customize the passthrough tint in your immersive space experience.

Get started with Dynamic Type
Dynamic Type lets people choose their preferred text size across the system and all of their apps. To help you get started supporting Dynamic Type, we’ll cover the fundamentals: How it works, how to find issues with scaling text in your app, and how to take practical steps using SwiftUI and UIKit to create a great Dynamic Type experience. We’ll also show how you can best use the Large Content Viewer to make navigation controls accessible to everyone.