Questions tagged [swiftui-sheet]

38 questions
8
votes
5 answers

Make sheet the exact size of the content inside

Let's say I have a custom view inside of a sheet, something like this VStack { Text("Title") Text("Some very long text ...") } .padding() .presentationDetents([.height(250)]) How can I get the exact height of the VStack and pass it to the…
Rahul Bir
  • 347
  • 2
  • 11
5
votes
2 answers

Presenting a sheet view with NavigationStack in SwiftUI

I am trying to figure out if there is a way to open a sheet with the new NavigationStack in iOS 16, but can't seem to find a way. So of cause, it's possible to open a sheet using: .sheet(isPresented: $isShowing) But with the new NavigationStack you…
bjorn.lau
  • 774
  • 5
  • 16
5
votes
2 answers

Allow user interaction in views behind a sheet in SwiftUI

Apple recently announced that half sheets will soon be feasible in SwiftUI with the addition of the .presentationDetents(detents: Set) modifier. Sadly, this still seems to block any user interaction with the views behind the…
pinglock
  • 982
  • 2
  • 12
  • 30
3
votes
1 answer

Dismissed view empties before animation starts when using SwiftUI navigation in combination with TCA

We are struggling with SwiftUI navigation in combination with TCA and I am wondering is someone else did encounter similar issue. The problem is that when we set parameters isPresented or isActive on .sheet or NavigationLink to false to dismiss it,…
2
votes
1 answer

Sheet displayed several times in SwiftUI

Short description: in detailView I've got a List of a related entity. For each item, there's a button to open the edit sheet for this item. List { if (book.booksBorrowers != nil) { ForEach (Array(book.booksBorrowers! as! Set), id:…
mihema
  • 158
  • 1
  • 10
2
votes
2 answers

How to determine if a popover will be displayed as a popover or sheet in SwiftUI?

In SwiftUI when a popover is displayed, it will display as either a popover or sheet depending on the device (iPad or iPhone) and window space available. Is there a correct heuristic to check if the popover will be displayed as a popover or a…
pinglock
  • 982
  • 2
  • 12
  • 30
1
vote
1 answer

SwiftUI .popover frame size incorrect

In iOS 16.4 we can now use .presentationCompactAdaptation(.none) in our .popover to achieve a true popover on iOS (compact screen sizes). SomeView() .popover(isPresented: $isPopoverOpen) { Text("Hello world!") …
eric
  • 45
  • 7
1
vote
0 answers

SwiftUI Are Presentation Detents supported on iPad?

So I have a minimum target of iOS 16, am using .sheet() with .presentationDetents([.medium]) and it works fine on iOS (iPhone). But when I load it on iPadOS it's always a fullsized sheet, seemingly ignoring the presentation detents. Here is a…
raynertanxw
  • 83
  • 1
  • 9
1
vote
0 answers

SwiftUI GeometryReader not working properly in sheet

I am trying to fit the size of a sheet to its content. There is another question on StackOverflow addressing this topic. However the problem is that GeometryReader does not seem to work properly when used inside a sheet, combined with the usage of…
Codey
  • 1,131
  • 2
  • 15
  • 34
1
vote
0 answers

SwiftUI modal .sheet() or .fullScreenCover will not dismiss on iPad if initial attempt fails

I have a SwiftUI app with a .sheet() which includes in its View a ColorPicker plus a toolbar button that dismisses the sheet (either using dismiss() or setting binding to false). On an iPhone everything works fine, but on an iPad things can be…
djmlewis
  • 273
  • 4
  • 7
1
vote
0 answers

How to use NavigationLink inside SwiftUI sheet

I have 4 SwiftUI View: The FirstView opens the SecondView using a sheet: .sheet(isPresented: $showSheet) { SecondView() } The SecondView opens the ThirdView using a sheet too: .sheet(isPresented: $showSheet) { …
Darya
  • 11
  • 2
1
vote
2 answers

swiftui how to find out if a sheet is currently being presented

I have an app with many nested views, some which show a sheet based on a user action. But I also have a sheet that I'd like to present on the main view based on a timer (ie, not a user action). But you can't have 2 sheets at the same time, so I'd…
Jack
  • 2,206
  • 3
  • 18
  • 25
1
vote
1 answer

NavigationLink or Sheet upon onTap Gesture

I am new in Swift, I am trying to build a test app in which I have people in a list, all works for inserting new people, I managed also swipe for delete, but I'm not able to find the right procedure to tap on a contact and open a sheet or a…
1
vote
1 answer

sheet can not be dismissed after an alert is displayed

I’m trying to show alerts in a sheet in SwiftUI. I have Cancel and Save buttons on the sheet and both of them are dismissed after the action is done.If there is an error on saving, an alert is pop upped. However, the sheet can not be dismissed…
Feyza
  • 11
  • 1
1
vote
1 answer

Body of a SwiftUI .sheet() is being evaluated after dismiss and not presenting

Use Case If you have a SwiftUI ContentView() that displays a PausableView() based on a @State property presentSheet that is also used to present a .sheet(), the body gets evaluated differently based on how the presentSheet property is used inside…
Calin
  • 2,110
  • 1
  • 21
  • 36
1
2 3