Skip to content

Commit 1632aae

Browse files
authored
Merge pull request #135 from liveviewnative/textfield-refactor
Add `TextField`/`SecureField`
2 parents 860d7a1 + ca402d7 commit 1632aae

File tree

17 files changed

+391
-207
lines changed

17 files changed

+391
-207
lines changed

Sources/LiveViewNative/BuiltinRegistry.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ struct BuiltinRegistry {
1616
switch name {
1717
case "textfield":
1818
TextField<R>(element: element, context: context)
19+
case "securefield":
20+
SecureField<R>(element: element, context: context)
1921
case "text":
2022
Text(element: element, context: context)
2123
case "hstack":

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ struct Button<R: CustomRegistry>: View {
2222
SwiftUI.Button(action: self.handleClick) {
2323
context.buildChildren(of: element)
2424
}
25-
.phxButtonStyle(buttonStyle)
25+
.applyButtonStyle(buttonStyle)
2626
.disabled(element.attributeValue(for: "disabled") != nil)
2727
}
2828

29-
private var buttonStyle: PhxButtonStyle {
29+
private var buttonStyle: ButtonStyle {
3030
if let s = element.attributeValue(for: "button-style"),
31-
let style = PhxButtonStyle(rawValue: s) {
31+
let style = ButtonStyle(rawValue: s) {
3232
return style
3333
} else {
3434
return .automatic
@@ -50,7 +50,7 @@ struct Button<R: CustomRegistry>: View {
5050

5151
}
5252

53-
fileprivate enum PhxButtonStyle: String {
53+
fileprivate enum ButtonStyle: String {
5454
case automatic
5555
case bordered
5656
case borderedProminent = "bordered-prominent"
@@ -60,7 +60,7 @@ fileprivate enum PhxButtonStyle: String {
6060

6161
fileprivate extension View {
6262
@ViewBuilder
63-
func phxButtonStyle(_ style: PhxButtonStyle) -> some View {
63+
func applyButtonStyle(_ style: ButtonStyle) -> some View {
6464
switch style {
6565
case .automatic:
6666
self.buttonStyle(.automatic)

0 commit comments

Comments
 (0)