Post

Replies

Boosts

Views

Activity

Sheet Presentation
Hi, would appreciate based on my implementation how can I control the dimmed effect of sheet presentation on iOS 17 later. Here is my sample implementation: struct ContentView: View { @State private var present = true var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() .sheet(isPresented: $present, content: { ContentView2() .modifier( SheetModifier( dismissDisabled: true, detents: [.medium, .large], dragIndicator: .hidden ) ) }) } } #Preview { ContentView() } struct SheetModifier: ViewModifier { var dismissDisabled: Bool var detents: Set<PresentationDetent> var backgroundInteraction: PresentationBackgroundInteraction var dragIndicator: Visibility var cornerRadius: CGFloat init( dismissDisabled: Bool = false, detents: Set<PresentationDetent>, backgroundInteraction: PresentationBackgroundInteraction = .automatic, dragIndicator: Visibility = .automatic, cornerRadius: CGFloat = 20 ) { self.dismissDisabled = dismissDisabled self.detents = detents self.backgroundInteraction = backgroundInteraction self.dragIndicator = dragIndicator self.cornerRadius = cornerRadius } func body(content: Content) -> some View { content .background(.clear) .interactiveDismissDisabled(dismissDisabled) .presentationDetents(detents) .presentationBackgroundInteraction(backgroundInteraction) .presentationDragIndicator(dragIndicator) .presentationCornerRadius(cornerRadius) } }
0
0
449
Jun ’24