Skip to content

Demo of how to handle multiple Sheets in a single SwiftUI Screen

Notifications You must be signed in to change notification settings

northofnormal/ManySheetsDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Say you have multiple sheets you want to display on a single screen. Let's say you don't want to have a bunch of different .sheet modifiers on your view. Here's a better idea.

Quick Tutorial

Step 1

Create some sheet views

Step 2

Create an enum containing each type of sheet you have avaiable. Conform to Identifiable and Hashable

Step 3

Create a sheet view with a switch statement that iterates over the enum of sheets and returns the appropriate view

Step 4

You'll need this cool extension on Binding

Step 5

Put it all together in the ContentView

About

Demo of how to handle multiple Sheets in a single SwiftUI Screen

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages