Skip to content

Commit 267770a

Browse files
authored
Make ProvidedBindingsKey public (#1006)
1 parent db8f1b9 commit 267770a

File tree

8 files changed

+19
-10
lines changed

8 files changed

+19
-10
lines changed

Package.resolved

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/LiveViewNative/BuiltinRegistry+applyBinding.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ extension BuiltinRegistry {
4040
}
4141

4242
/// A preference key that specifies what bindings the View handles internally.
43-
enum ProvidedBindingsKey: PreferenceKey {
44-
static var defaultValue: Set<String> { [] }
45-
static func reduce(value: inout Set<String>, nextValue: () -> Set<String>) {
43+
public enum _ProvidedBindingsKey: PreferenceKey {
44+
public static var defaultValue: Set<String> { [] }
45+
public static func reduce(value: inout Set<String>, nextValue: () -> Set<String>) {
4646
value = nextValue()
4747
}
4848
}
@@ -61,7 +61,7 @@ fileprivate struct ProvidedBindingsReader<Content: View, ApplyBinding: View>: Vi
6161
applyBinding()
6262
}
6363
}
64-
.onPreferenceChange(ProvidedBindingsKey.self) { self.providesBinding = $0.contains(binding) }
64+
.onPreferenceChange(_ProvidedBindingsKey.self) { self.providesBinding = $0.contains(binding) }
6565
}
6666
}
6767

Sources/LiveViewNative/ViewTree.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct ViewTreeBuilder<R: RootRegistry> {
7878

7979
return withIDAndTag
8080
.environment(\.element, element)
81-
.preference(key: ProvidedBindingsKey.self, value: []) // reset for the next View.
81+
.preference(key: _ProvidedBindingsKey.self, value: []) // reset for the next View.
8282
}
8383

8484
@ViewBuilder

Sources/LiveViewNative/Views/Controls and Indicators/Buttons/Button.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public struct Button<R: RootRegistry>: View {
5757
context.buildChildren(of: element)
5858
}
5959
.disabled(disabled)
60-
.preference(key: ProvidedBindingsKey.self, value: ["phx-click"])
60+
.preference(key: _ProvidedBindingsKey.self, value: ["phx-click"])
6161
}
6262

6363
private func handleClick() {

Sources/LiveViewNative/Views/Controls and Indicators/Buttons/PasteButton.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct PasteButton<R: RootRegistry>: View {
5555
SwiftUI.PasteButton(payloadType: String.self) { strings in
5656
click(value: ["value": strings]) {}
5757
}
58-
.preference(key: ProvidedBindingsKey.self, value: ["phx-click"])
58+
.preference(key: _ProvidedBindingsKey.self, value: ["phx-click"])
5959
#endif
6060
}
6161
}

Sources/LiveViewNative/Views/Text Input and Output/SecureField.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct SecureField<R: RootRegistry>: TextFieldProtocol {
5555
}
5656
.focused($isFocused)
5757
.onChange(of: isFocused, perform: handleFocus)
58-
.preference(key: ProvidedBindingsKey.self, value: ["phx-focus", "phx-blur"])
58+
.preference(key: _ProvidedBindingsKey.self, value: ["phx-focus", "phx-blur"])
5959
}
6060

6161
var label: some View {

Sources/LiveViewNative/Views/Text Input and Output/TextEditor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct TextEditor: TextFieldProtocol {
4141
SwiftUI.TextEditor(text: textBinding)
4242
.focused($isFocused)
4343
.onChange(of: isFocused, perform: handleFocus)
44-
.preference(key: ProvidedBindingsKey.self, value: ["phx-focus", "phx-blur"])
44+
.preference(key: _ProvidedBindingsKey.self, value: ["phx-focus", "phx-blur"])
4545
#endif
4646
}
4747
}

Sources/LiveViewNative/Views/Text Input and Output/TextField.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ struct TextField<R: RootRegistry>: TextFieldProtocol {
154154
field
155155
.focused($isFocused)
156156
.onChange(of: isFocused, perform: handleFocus)
157-
.preference(key: ProvidedBindingsKey.self, value: ["phx-focus", "phx-blur"])
157+
.preference(key: _ProvidedBindingsKey.self, value: ["phx-focus", "phx-blur"])
158158
}
159159

160160
@ViewBuilder

0 commit comments

Comments
 (0)