Created
June 21, 2023 07:47
-
-
Save MojtabaHs/81395bb2be673698e6531b7e56ba5c61 to your computer and use it in GitHub Desktop.
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
struct ContentView: View { | |
@State var topLeading: CGFloat = 0 | |
@State var topTrailing: CGFloat = 50 | |
@State var bottomLeading: CGFloat = 50 | |
@State var bottomTrailing: CGFloat = 0 | |
var body: some View { | |
VStack { | |
HStack(spacing: 32) { | |
Slider(value: $topLeading, in: 0...50) | |
Slider(value: $topTrailing, in: 0...50) | |
} | |
Text("Round me") | |
.frame (width: 200, height: 100) | |
.background(.red) | |
.clipShape( | |
.rect( | |
topLeadingRadius: topLeading, | |
bottomLeadingRadius: bottomLeading, | |
bottomTrailingRadius: bottomTrailing, | |
topTrailingRadius: topTrailing, | |
style: .continuous | |
) | |
) | |
HStack(spacing: 32) { | |
Slider(value: $bottomLeading, in: 0...50) | |
Slider(value: $bottomTrailing, in: 0...50) | |
} | |
}.padding() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
💡 You can use this method until the GM release of the Xcode 15