Created
August 4, 2024 01:26
-
-
Save Koshimizu-Takehito/1a2be566c4889c3074ccc9bb01ea5143 to your computer and use it in GitHub Desktop.
UnevenRoundedRectangle Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
Group { | |
HelloWorld() | |
.clipShape(UnevenRoundedRectangle( | |
topLeadingRadius: 80, | |
bottomTrailingRadius: 80 | |
)) | |
HelloWorld() | |
.clipShape(.rect( | |
topLeadingRadius: 80, | |
bottomTrailingRadius: 80 | |
)) | |
} | |
.padding(.horizontal) | |
.padding() | |
} | |
} | |
struct HelloWorld: View { | |
var body: some View { | |
Text("Hello, world!") | |
.font(.largeTitle.bold()) | |
.foregroundStyle(.white) | |
.frame(maxWidth: .infinity, maxHeight: .infinity) | |
.background(.blue.gradient) | |
} | |
} | |
#Preview { | |
ContentView() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment