Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 541 Bytes

README.md

File metadata and controls

38 lines (30 loc) · 541 Bytes

Using ViewModifier

struct TitleModifier: ViewModifier {

    func body(content: Content) -> some View {
        content
            .font(.largeTitle)
    }

}
    var body: some View {
        Text("Bigger Text")
            .modifier(TitleModifier())
    }

Using extension(much simpler💡)

extension View {

    func title() -> some View {
        self
            .font(.largeTitle)
    }

}
    var body: some View {
        Text("Bigger Text")
            .title()
    }