One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

EmptyModifier

struct · iOS 13.0+ · SDK 27.1

@frozen nonisolated struct EmptyModifier

An empty, or identity, modifier, used during development to switch modifiers at compile time. 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 } }

Members (3)

method · iOS 13.0+

body

TypeScript
body(content: SDKHandle): never
Swift declaration
nonisolated func body(content: EmptyModifier.Content) -> EmptyModifier.Body

Gets the current body of the caller. `content` is a proxy for the view that will have the modifier represented by `Self` applied to it.

get · iOS 13.0+

identity

TypeScript
static get identity(): EmptyModifier
Swift declaration
static let identity: EmptyModifier
init · iOS 13.0+

init

TypeScript
static init(): EmptyModifier
Swift declaration
nonisolated init()

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUICore types →