Home > AI > IOS > SwiftUI >

transformEnvironment(_:transform:)

Transforms the environment value of the specified key path with the given function.

struct ContentView: View {
    var body: some View {
        VStack {
            Text("Hello, world!")
                .transformEnvironment(\.font) { dump($0) }
        }
        .font(Font.headline)
    }
}

Leave a Reply