Skip to content

Instantly share code, notes, and snippets.

@gaosa
Created December 21, 2019 12:09
Show Gist options
  • Save gaosa/6eabf6efb860728e5b4d846cb7c7ef29 to your computer and use it in GitHub Desktop.
Save gaosa/6eabf6efb860728e5b4d846cb7c7ef29 to your computer and use it in GitHub Desktop.
Squircle in SwiftUI
// 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())
@AlexJuca
Copy link

AlexJuca commented Jan 5, 2023

Thanks a ton for this!

@iliya-pro
Copy link

iliya-pro commented May 27, 2025

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