Skip to content

Instantly share code, notes, and snippets.

@eecs441staff
Last active March 18, 2024 20:35
Show Gist options
  • Save eecs441staff/84124772bf9c58e971e7f7209ca755f7 to your computer and use it in GitHub Desktop.
Save eecs441staff/84124772bf9c58e971e7f7209ca755f7 to your computer and use it in GitHub Desktop.
// UM EECS 441
import SwiftUI
struct Froggy: ViewModifier {
func body(content: Content) -> some View {
content
.font(.custom("Times New Roman", size: 32))
.foregroundColor(.green)
.bold()
}
}
extension Text {
func froggy() -> some View {
ModifiedContent(content: self, modifier: Froggy())
}
}
struct HaikuView: View {
var body: some View {
Text("Furu ike ya")
.font(.system(size: 36))
Text("kawazu tobikomu")
.font(.system(size: 36))
Text("mizu no oto")
.font(.system(size: 36))
Spacer()
Group {
Text("Furu ike ya")
Text("kawazu tobikomu")
Text("mizu no oto")
}
.font(.system(size: 36))
Spacer()
Text("Furu ike ya")
.font(.custom("Times New Roman", size: 36))
.foregroundColor(.green)
.bold()
Text("kawazu tobikomu")
Text("mizu no oto")
.font(.custom("Times New Roman", size: 36))
.foregroundColor(.green)
.bold()
Spacer()
Text("Furu ike ya")
.froggy()
Text("kawazu tobikomu")
Text("mizu no oto")
.froggy()
}
}
struct ContentView: View {
var body: some View {
VStack {
HaikuView()
}
.font(.system(size: 28))
.padding()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment