[IOS-SwiftUI] .safeAreaInset(edge: .bottom) 쓰면서 모서리 Radius 주는 방법 (바텀시트처럼)

2025. 11. 8.



.safeAreaInset(edge: .bottom) 내에 들어가는 View에 mask 씌우기

.mask {
    UnevenRoundedRectangle(topLeadingRadius: 10, topTrailingRadius: 10)
        .ignoresSafeArea()
}

 

cornerRadius 값을 주거나 clipshape 하면 safeArea 위로 떠 버리는 문제가 있었는데

.ignoresSafeArea()를 먹인 도형으로 마스크를 걸어주면 된다!

Before / After

 

출처: https://stackoverflow.com/questions/78705662/swiftui-overlay-either-rounded-corners-or

댓글