-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathEmptyModifier.swift
69 lines (64 loc) · 1.94 KB
/
EmptyModifier.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// EmptyModifier.swift
// OpenSwiftUI
//
// Audited for RELEASE_2021
// Status: Blocked by PrimitiveSceneModifier
/// 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
/// }
/// }
///
@frozen
public struct EmptyModifier: PrimitiveViewModifier/*, PrimitiveSceneModifier*/ {
public static let identity = EmptyModifier()
@inlinable
public init() {}
public static func _makeView(
modifier: _GraphValue<Self>,
inputs: _ViewInputs,
body: @escaping (_Graph, _ViewInputs) -> _ViewOutputs
) -> _ViewOutputs {
body(_Graph(), inputs)
}
public static func _makeViewList(
modifier: _GraphValue<Self>,
inputs: _ViewListInputs,
body: @escaping (_Graph, _ViewListInputs) -> _ViewListOutputs
) -> _ViewListOutputs {
body(_Graph(), inputs)
}
public static func _viewListCount(
inputs: _ViewListCountInputs,
body: (_ViewListCountInputs) -> Int?
) -> Int? {
body(inputs)
}
}