Skip to content

Instantly share code, notes, and snippets.

@breyed
Created July 6, 2023 01:41
Show Gist options
  • Save breyed/f262aa0c52bb6368be08083ab417b717 to your computer and use it in GitHub Desktop.
Save breyed/f262aa0c52bb6368be08083ab417b717 to your computer and use it in GitHub Desktop.
Aaron 18th birthday
import SwiftUI
struct ContentView: View {
@State private var hex = false
@State private var binary = false
var body: some View {
VStack(spacing: 60) {
Text("Happy birthday, Aaron!\n" + "Choose your present.").font(.largeTitle).multilineTextAlignment(.center)
HStack {
Button(action: { hex = true; binary = false }) {
Image(systemName: "birthday.cake").imageScale(.large)
}
if (hex) { Text("$0x14") }
}.font(.title)
HStack {
Button(action: { hex = false; binary = true }) {
Image(systemName: "birthday.cake.fill").imageScale(.large)
}
if (binary) { Text("$0b101000") }
}.font(.title)
}
.padding()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment