Skip to content

Instantly share code, notes, and snippets.

@maxhumber
Last active May 25, 2022 17:12
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 maxhumber/1dbdf0d9c4539a8e145b3c630c6da0b3 to your computer and use it in GitHub Desktop.
Save maxhumber/1dbdf0d9c4539a8e145b3c630c6da0b3 to your computer and use it in GitHub Desktop.
SwiftUI in 2022
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View {
GeometryReader { geo in
ZStack {
ZStack(alignment: .topLeading) {
Color.red
.aspectRatio(1, contentMode: .fit)
.padding(10)
Color.blue
.aspectRatio(1, contentMode: .fit)
.padding(10)
.frame(width: geo.size.width * 0.1)
}
Color.blue
.aspectRatio(1, contentMode: .fit)
.frame(width: geo.size.width * 0.5)
}
}
.frame(width: 300, height: 500)
}
}
PlaygroundPage.current.setLiveView(ContentView())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment