Alex does a variety of things poorly - swift, data science, datavis, ML, drawing, AR, unity, etc, etc.
by alex
More 100 Days of SwiftUI today, learning some fundamentals for how SwiftUI actually does things under the hood.
Mostly review for me, but it was cool to go over custom view composition again since that’s something I haven’t done in a while. One thing new for me, I didn’t realize how easy it was to make custom modifiers, so much fun!
struct WeddingModifier: ViewModifier {
func body(content: Content) -> some View {
content
.font(.custom("Zapfino", size: 24))
}
}
extension Text {
func weddingText() -> some View {
self.modifier(WeddingModifier())
}
}
struct MyView: View {
var body: some View {
Text("Hello, World")
.weddingText()
}
}