Skip to content

Instantly share code, notes, and snippets.

@gahntpo
Created June 19, 2020 15:37
Show Gist options
  • Save gahntpo/dfbc971afa110e2f14b75d0767c828ef to your computer and use it in GitHub Desktop.
Save gahntpo/dfbc971afa110e2f14b75d0767c828ef to your computer and use it in GitHub Desktop.
using flexible frames to layout depending on available space
HStack {
Text("using maxWidth 300")
.frame(minWidth: 100, idealWidth: 200, maxWidth: 300).border(Color.red)
Text("taking space")
}
HStack {
Text("using maxWidth 200")
.frame(minWidth: 100, idealWidth: 150, maxWidth: 200).border(Color.red)
Text("taking space")
}
HStack {
Text("using maxWidth 100")
.frame(minWidth: 10, idealWidth: 100, maxWidth: 100).border(Color.red)
Text("taking space")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment