Last active
March 16, 2022 09:39
-
-
Save swiftui-lab/e35bd98a0eada970e9274fcb020c47f0 to your computer and use it in GitHub Desktop.
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
// The SwiftUI Lab: https://swiftui-lab.com | |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
Text("hello world!") | |
.padding(20) | |
.addBorder(Color.blue, width: 3.0, cornerRadius: 80) | |
} | |
} | |
extension View { | |
public func addBorder<S>(_ content: S, width: CGFloat = 1, cornerRadius: CGFloat) -> some View where S : ShapeStyle { | |
return overlay(RoundedRectangle(cornerRadius: cornerRadius).strokeBorder(content, lineWidth: width)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment