Skip to content

Instantly share code, notes, and snippets.

@EnesKaraosman
Last active April 16, 2020 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EnesKaraosman/ec26f79db74e62f219e53ebc4232f1da to your computer and use it in GitHub Desktop.
Save EnesKaraosman/ec26f79db74e62f219e53ebc4232f1da to your computer and use it in GitHub Desktop.
Border-Fill-Stroke
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