Structure

EmptyModifier

An empty, or identity, modifier, used during development to switch modifiers at compile time.

Declaration 宣言

@frozen struct EmptyModifier

Overview 概要

Use the empty modifier to switch modifiers at compile time during development. In the example below, in a debug build the Text view inside ContentView has a yellow background and a red border. A non-debug build reflects the default system, or container supplied appearance.


struct EmphasizedLayout: ViewModifier {
    func body(content: Content) -> some View {
        content
            .background(Color.yellow)
            .border(Color.red)
    }
}


struct ContentView: View {
    var body: some View {
        Text("Hello, World!")
            .modifier(modifier)
    }


    var modifier: some ViewModifier {
        #if DEBUG
            return EmphasizedLayout()
        #else
            return EmptyModifier()
        #endif
    }
}

Topics 話題

Creating an Empty Modifier 空の修飾子を作成する

Getting the Identity Modifier 同一性修飾子を取得する

Supporting Types 支援を行う型

Default Implementations 省略時実装

Relationships 関係

Conforms To 次に準拠

See Also 参照

View Modifiers ビュー修飾子