HomeiOS DevelopmentMethods to match the width of sheets in swiftUI to match the...

Methods to match the width of sheets in swiftUI to match the background?


I’m calling the apple sheet api however within the present implementation i get the padding across the sheet as its the ios26 design however i dont need it. how can we take away this

Required Implementation

Methods to match the width of sheets in swiftUI to match the background?

present Implementationcurrent implemntation


.sheet(merchandise: $coordinator.presentingSheet) { sheet in
            DynamicSheet(animation: .snappy(length: 0.10,extraBounce: 0)){
                coordinator
                    .construct(sheet)
            }
        }
import SwiftUI

struct DynamicSheet<Content material: View>: View {
    var animation: Animation
    @ViewBuilder var content material: Content material

    @State personal var sheetHeight: CGFloat = .zero

    var physique: some View {
        content material
            .onPreferenceChange(HeightPreferenceKey.self) { peak in
                guard peak > 0 else { return }
                withAnimation(animation) {
                    sheetHeight = peak
                }
            }
            .presentationDetents(
                sheetHeight == .zero ? [.medium] : [.height(sheetHeight)]
            )
            .presentationDragIndicator(.seen)
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments