ContentView.swift
// // ContentView.swift // SwiftUIProject // // Created by Cairocoders // import SwiftUI extension View { func addNavigationView(title: String) -> some View { NavigationView { self .navigationTitle(title) } } func centerHorizontal() -> some View { HStack { Spacer() self Spacer() } } func customfont() -> some View { self .font(.system(size: 20, weight: .bold, design: .monospaced)) .foregroundColor(.indigo) } } struct ContentView: View { var body: some View { Form { Text("Hello, world!") .customfont() .centerHorizontal() Button("Submit") { print("Button pressed.") } .centerHorizontal() } .addNavigationView(title: "Custom Modifier") } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }