Last active
April 16, 2020 12:15
-
-
Save EnesKaraosman/ec26f79db74e62f219e53ebc4232f1da to your computer and use it in GitHub Desktop.
Border-Fill-Stroke
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
HStack(spacing: 16) { | |
// 1 | |
Rectangle() | |
.fill(Color.orange) | |
.frame(width: 60, height: 60) | |
// 2 | |
Rectangle() | |
.stroke( | |
Color.red, | |
style: .init(lineWidth: 10, lineCap: .round, lineJoin: .round) | |
) | |
.frame(width: 60, height: 60) | |
// 3 (1 over 2) | |
Rectangle() | |
.fill(Color.orange) | |
.frame(width: 60, height: 60) | |
.overlay( | |
Rectangle() | |
.stroke( | |
Color.red, | |
style: .init(lineWidth: 10, lineCap: .round, lineJoin: .round) | |
) | |
.frame(width: 60, height: 60) | |
) | |
// 4 | |
Rectangle() | |
.border(Color.red, width: 10) | |
.foregroundColor(.orange) | |
.frame(width: 60, height: 60) | |
// 5 | |
Rectangle() | |
.foregroundColor(.orange) | |
.overlay( | |
RoundedRectangle(cornerRadius: 10, style: .circular) | |
.stroke(lineWidth: 10) | |
.foregroundColor(.red) | |
) | |
.frame(width: 60, height: 60) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment