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

0
1
How to match the width of sheets in swiftUI to match the background?


I am calling the apple sheet api but in the current implementation i am getting the padding around the sheet as its the ios26 design but i dont want it. how can we remove this

Required Implementation

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

current Implementationcurrent implemntation


.sheet(item: $coordinator.presentingSheet) { sheet in
            DynamicSheet(animation: .snappy(duration: 0.10,extraBounce: 0)){
                coordinator
                    .build(sheet)
            }
        }
import SwiftUI

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

    @State private var sheetHeight: CGFloat = .zero

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