Skip to content

Commit 94e6313

Browse files
committed
Fix watchos pod lib lit failure
1 parent 9d6503e commit 94e6313

File tree

7 files changed

+380
-353
lines changed

7 files changed

+380
-353
lines changed

RichEditorSwiftUI.podspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ Pod::Spec.new do |s|
2020

2121
s.swift_version = "5.9"
2222

23-
#s.ios.deployment_target = "15.0"
24-
#s.osx.deployment_target = "12.0"
25-
#s.tvos.deployment_target = "17.0"
23+
s.ios.deployment_target = "15.0"
24+
s.osx.deployment_target = "12.0"
25+
s.tvos.deployment_target = "17.0"
2626
s.watchos.deployment_target = "8.0"
27-
#Cocoapods pod lib lint fail with vision os as it's throwing error "Could not find a `xros` simulator"
27+
Cocoapods pod lib lint fail with vision os as it's throwing error "Could not find a `xros` simulator"
2828
#s.visionos.deployment_target = "1.0"
2929

3030
s.preserve_paths = "README.md"

Sources/RichEditorSwiftUI/RichTextOtherMenu/RichTextOtherMenu+Button.swift

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
import SwiftUI
99

10-
extension RichTextOtherMenu {
10+
#if os(iOS) || os(macOS) || os(visionOS)
11+
extension RichTextOtherMenu {
1112

1213
/**
1314
This button can be used to toggle a ``RichTextOtherMenu``.
@@ -17,70 +18,71 @@ extension RichTextOtherMenu {
1718
*/
1819
public struct Button: View {
1920

20-
/**
21+
/**
2122
Create a rich text style button.
2223

2324
- Parameters:
2425
- style: The style to toggle.
2526
- value: The value to bind to.
2627
- fillVertically: Whether or not fill up vertical space in a non-greedy way, by default `false`.
2728
*/
28-
public init(
29-
style: RichTextOtherMenu,
30-
value: Binding<Bool>,
31-
fillVertically: Bool = false
32-
) {
33-
self.style = style
34-
self.value = value
35-
self.fillVertically = fillVertically
36-
}
29+
public init(
30+
style: RichTextOtherMenu,
31+
value: Binding<Bool>,
32+
fillVertically: Bool = false
33+
) {
34+
self.style = style
35+
self.value = value
36+
self.fillVertically = fillVertically
37+
}
3738

38-
/**
39+
/**
3940
Create a rich text style button.
4041

4142
- Parameters:
4243
- style: The style to toggle.
4344
- context: The context to affect.
4445
- fillVertically: Whether or not fill up vertical space in a non-greedy way, by default `false`.
4546
*/
46-
public init(
47-
style: RichTextOtherMenu,
48-
context: RichEditorState,
49-
fillVertically: Bool = false
50-
) {
51-
self.init(
52-
style: style,
53-
value: context.binding(for: style),
54-
fillVertically: fillVertically
55-
)
56-
}
47+
public init(
48+
style: RichTextOtherMenu,
49+
context: RichEditorState,
50+
fillVertically: Bool = false
51+
) {
52+
self.init(
53+
style: style,
54+
value: context.bindingForManu(for: style),
55+
fillVertically: fillVertically
56+
)
57+
}
5758

58-
private let style: RichTextOtherMenu
59-
private let value: Binding<Bool>
60-
private let fillVertically: Bool
59+
private let style: RichTextOtherMenu
60+
private let value: Binding<Bool>
61+
private let fillVertically: Bool
6162

62-
public var body: some View {
63-
SwiftUI.Button(action: toggle) {
64-
style.label
65-
.labelStyle(.iconOnly)
66-
.frame(maxHeight: fillVertically ? .infinity : nil)
67-
.contentShape(Rectangle())
68-
}
69-
.tint(.accentColor, if: isOn)
70-
.foreground(.accentColor, if: isOn)
71-
// .keyboardShortcut(for: style)
72-
.accessibilityLabel(style.title)
63+
public var body: some View {
64+
SwiftUI.Button(action: toggle) {
65+
style.label
66+
.labelStyle(.iconOnly)
67+
.frame(maxHeight: fillVertically ? .infinity : nil)
68+
.contentShape(Rectangle())
7369
}
70+
.tint(.accentColor, if: isOn)
71+
.foreground(.accentColor, if: isOn)
72+
// .keyboardShortcut(for: style)
73+
.accessibilityLabel(style.title)
74+
}
7475
}
75-
}
76+
}
7677

77-
extension RichTextOtherMenu.Button {
78+
extension RichTextOtherMenu.Button {
7879

7980
fileprivate var isOn: Bool {
80-
value.wrappedValue
81+
value.wrappedValue
8182
}
8283

8384
fileprivate func toggle() {
84-
value.wrappedValue.toggle()
85+
value.wrappedValue.toggle()
8586
}
86-
}
87+
}
88+
#endif

Sources/RichEditorSwiftUI/RichTextOtherMenu/RichTextOtherMenu+Toggle.swift

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
import SwiftUI
99

10-
extension RichTextOtherMenu {
10+
#if os(iOS) || os(macOS) || os(visionOS)
11+
extension RichTextOtherMenu {
1112

1213
/**
1314
This toggle can be used to toggle a ``RichTextOtherMenu``.
@@ -18,70 +19,71 @@ extension RichTextOtherMenu {
1819
*/
1920
public struct Toggle: View {
2021

21-
/**
22+
/**
2223
Create a rich text style toggle toggle.
2324

2425
- Parameters:
2526
- style: The style to toggle.
2627
- value: The value to bind to.
2728
- fillVertically: Whether or not fill up vertical space in a non-greedy way, by default `false`.
2829
*/
29-
public init(
30-
style: RichTextOtherMenu,
31-
value: Binding<Bool>,
32-
fillVertically: Bool = false
33-
) {
34-
self.style = style
35-
self.value = value
36-
self.fillVertically = fillVertically
37-
}
30+
public init(
31+
style: RichTextOtherMenu,
32+
value: Binding<Bool>,
33+
fillVertically: Bool = false
34+
) {
35+
self.style = style
36+
self.value = value
37+
self.fillVertically = fillVertically
38+
}
3839

39-
/**
40+
/**
4041
Create a rich text style toggle.
4142

4243
- Parameters:
4344
- style: The style to toggle.
4445
- context: The context to affect.
4546
- fillVertically: Whether or not fill up vertical space in a non-greedy way, by default `false`.
4647
*/
47-
public init(
48-
style: RichTextOtherMenu,
49-
context: RichEditorState,
50-
fillVertically: Bool = false
51-
) {
52-
self.init(
53-
style: style,
54-
value: context.binding(for: style),
55-
fillVertically: fillVertically
56-
)
57-
}
48+
public init(
49+
style: RichTextOtherMenu,
50+
context: RichEditorState,
51+
fillVertically: Bool = false
52+
) {
53+
self.init(
54+
style: style,
55+
value: context.bindingForManu(for: style),
56+
fillVertically: fillVertically
57+
)
58+
}
5859

59-
private let style: RichTextOtherMenu
60-
private let value: Binding<Bool>
61-
private let fillVertically: Bool
60+
private let style: RichTextOtherMenu
61+
private let value: Binding<Bool>
62+
private let fillVertically: Bool
6263

63-
public var body: some View {
64-
#if os(tvOS) || os(watchOS)
65-
toggle
66-
#else
67-
toggle.toggleStyle(.button)
68-
#endif
69-
}
64+
public var body: some View {
65+
#if os(tvOS) || os(watchOS)
66+
toggle
67+
#else
68+
toggle.toggleStyle(.button)
69+
#endif
70+
}
7071

71-
private var toggle: some View {
72-
SwiftUI.Toggle(isOn: value) {
73-
style.icon
74-
.frame(maxHeight: fillVertically ? .infinity : nil)
75-
}
76-
// .keyboardShortcut(for: style)
77-
.accessibilityLabel(style.title)
72+
private var toggle: some View {
73+
SwiftUI.Toggle(isOn: value) {
74+
style.icon
75+
.frame(maxHeight: fillVertically ? .infinity : nil)
7876
}
77+
// .keyboardShortcut(for: style)
78+
.accessibilityLabel(style.title)
79+
}
7980
}
80-
}
81+
}
8182

82-
extension RichTextOtherMenu.Toggle {
83+
extension RichTextOtherMenu.Toggle {
8384

8485
fileprivate var isOn: Bool {
85-
value.wrappedValue
86+
value.wrappedValue
8687
}
87-
}
88+
}
89+
#endif

Sources/RichEditorSwiftUI/RichTextOtherMenu/RichTextOtherMenu+ToggleStack.swift

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
import SwiftUI
99

10-
extension RichTextOtherMenu {
10+
#if os(iOS) || os(macOS) || os(visionOS)
11+
12+
extension RichTextOtherMenu {
1113

1214
/**
1315
This view can list ``RichTextOtherMenu/Toggle``s for a list
@@ -18,41 +20,42 @@ extension RichTextOtherMenu {
1820
*/
1921
public struct ToggleStack: View {
2022

21-
/**
23+
/**
2224
Create a rich text style toggle button group.
2325

2426
- Parameters:
2527
- context: The context to affect.
2628
- styles: The styles to list, by default ``RichTextOtherMenu/all``.
2729
- spacing: The spacing to apply to stack items, by default `5`.
2830
*/
29-
public init(
30-
context: RichEditorState,
31-
styles: [RichTextOtherMenu] = .all,
32-
spacing: Double = 5
33-
) {
34-
self._context = ObservedObject(wrappedValue: context)
35-
self.styles = styles
36-
self.spacing = spacing
37-
}
38-
39-
private let styles: [RichTextOtherMenu]
40-
private let spacing: Double
41-
42-
@ObservedObject
43-
private var context: RichEditorState
44-
45-
public var body: some View {
46-
HStack(spacing: spacing) {
47-
ForEach(styles) {
48-
RichTextOtherMenu.Toggle(
49-
style: $0,
50-
context: context,
51-
fillVertically: true
52-
)
53-
}
54-
}
55-
.fixedSize(horizontal: false, vertical: true)
31+
public init(
32+
context: RichEditorState,
33+
styles: [RichTextOtherMenu] = .all,
34+
spacing: Double = 5
35+
) {
36+
self._context = ObservedObject(wrappedValue: context)
37+
self.styles = styles
38+
self.spacing = spacing
39+
}
40+
41+
private let styles: [RichTextOtherMenu]
42+
private let spacing: Double
43+
44+
@ObservedObject
45+
private var context: RichEditorState
46+
47+
public var body: some View {
48+
HStack(spacing: spacing) {
49+
ForEach(styles) {
50+
RichTextOtherMenu.Toggle(
51+
style: $0,
52+
context: context,
53+
fillVertically: true
54+
)
55+
}
5656
}
57+
.fixedSize(horizontal: false, vertical: true)
58+
}
5759
}
58-
}
60+
}
61+
#endif

0 commit comments

Comments
 (0)