Created
December 21, 2019 12:09
-
-
Save gaosa/6eabf6efb860728e5b4d846cb7c7ef29 to your computer and use it in GitHub Desktop.
Squircle in SwiftUI
This file contains hidden or 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
// Run in Swift Playground | |
import SwiftUI | |
import PlaygroundSupport | |
struct ContentView: View { | |
var body: some View { | |
Rectangle() | |
.fill(Color.red) | |
.frame(width: 200, height: 200) | |
.clipShape(RoundedRectangle(cornerRadius: 50, style: .continuous)) | |
} | |
} | |
PlaygroundPage.current.setLiveView(ContentView()) |
You are on top of Google search. Congratulations and thanks!
BTW, now (from iOS 17) you don't need to explicitly set .continuous
style, as it's already set by default.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a ton for this!