Skip to content

Commit a178307

Browse files
committed
Fix macOS build
1 parent e304362 commit a178307

File tree

6 files changed

+16
-1
lines changed

6 files changed

+16
-1
lines changed

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import PackageDescription
66
let package = Package(
77
name: "LiveViewNative",
88
platforms: [
9-
.iOS("16.0")
9+
.iOS("16.0"),
10+
.macOS("13.0"),
1011
],
1112
products: [
1213
// Products define the executables and libraries a package produces, and make them visible to other packages.

Sources/LiveViewNative/BuiltinRegistry.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ struct BuiltinRegistry {
5656
Link(element: element, context: context)
5757
case "divider":
5858
Divider()
59+
#if !os(macOS)
5960
case "edit-button":
6061
EditButton()
62+
#endif
6163
case "toggle":
6264
Toggle(element: element, context: context)
6365
case "phx-form":

Sources/LiveViewNative/Views/Layout Containers/Collection Containers/List.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ private extension SwiftUI.List {
4545
switch element.attributeValue(for: "style") {
4646
case nil, "plain":
4747
self.listStyle(.plain)
48+
#if !os(macOS)
4849
case "grouped":
4950
self.listStyle(.grouped)
5051
case "inset-grouped":
5152
self.listStyle(.insetGrouped)
53+
#endif
5254
default:
5355
fatalError("Invalid list style '\(element.attributeValue(for: "name")!)'")
5456
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ struct SecureField<R: CustomRegistry>: TextFieldProtocol {
2626
.focused($isFocused)
2727
.applyTextFieldStyle(textFieldStyle)
2828
.applyAutocorrectionDisabled(disableAutocorrection)
29+
#if !os(macOS)
2930
.textInputAutocapitalization(autocapitalization)
3031
.applyKeyboardType(keyboard)
32+
#endif
3133
.applySubmitLabel(submitLabel)
3234
.onChange(of: isFocused, perform: handleFocus)
3335
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ struct TextField<R: CustomRegistry>: TextFieldProtocol {
2222
.focused($isFocused)
2323
.applyTextFieldStyle(textFieldStyle)
2424
.applyAutocorrectionDisabled(disableAutocorrection)
25+
#if !os(macOS)
2526
.textInputAutocapitalization(autocapitalization)
2627
.applyKeyboardType(keyboard)
28+
#endif
2729
.applySubmitLabel(submitLabel)
2830
.onChange(of: isFocused, perform: handleFocus)
2931
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ extension TextFieldProtocol {
9191
}
9292
}
9393

94+
#if !os(macOS)
9495
var autocapitalization: TextInputAutocapitalization? {
9596
switch element.attributeValue(for: "autocapitalization") {
9697
case "sentences":
@@ -105,7 +106,9 @@ extension TextFieldProtocol {
105106
return nil
106107
}
107108
}
109+
#endif
108110

111+
#if !os(macOS)
109112
var keyboard: UIKeyboardType? {
110113
switch element.attributeValue(for: "keyboard") {
111114
case "ascii-capable":
@@ -134,6 +137,7 @@ extension TextFieldProtocol {
134137
return nil
135138
}
136139
}
140+
#endif
137141

138142
var submitLabel: SubmitLabel? {
139143
switch element.attributeValue(for: "submit-label") {
@@ -196,6 +200,7 @@ extension View {
196200
}
197201
}
198202

203+
#if !os(macOS)
199204
@ViewBuilder
200205
func applyKeyboardType(_ keyboardType: UIKeyboardType?) -> some View {
201206
if let keyboardType {
@@ -204,6 +209,7 @@ extension View {
204209
self
205210
}
206211
}
212+
#endif
207213

208214
@ViewBuilder
209215
func applySubmitLabel(_ submitLabel: SubmitLabel?) -> some View {

0 commit comments

Comments
 (0)