Skip to content

Commit 1de02e4

Browse files
committed
Add extra @available
1 parent 8863e36 commit 1de02e4

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ For a more in-depth explanation, see [here](https://github.com/EmergeTools/Snaps
99

1010
### Warning
1111
These features are not exposed by the stable interface and may be removed or changed in OS version updates.
12+
Note that this package was only tested against macOS 14. Some features may not be available on older versions, but lack `@available` annotations. If you notice any crashes / issues on lower versions, please create an issue.
1213

1314
### Overview
1415
All exposed functions are behind the `hidden` variable. This way, when Apple makes them public, no name clashes occur.

Sources/SwiftUIHidden/Form+init.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import SwiftUI
99

1010
public extension Form {
1111
/// Add a footer to a form.
12+
@available(macOS 13.0, *)
1213
static func withFooter<C: View, F: View>(@ViewBuilder content: () -> C, @ViewBuilder footer: () -> F) -> some View {
1314
Form<FormFooterContent<C, F>>(content: content, footer: footer)
1415
}

Sources/SwiftUIHidden/View+extensions.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public extension View {
1616
public enum FullScreenToolbarBehavior {
1717
case showsWithWindow, showsWithMenuBar, automatic
1818

19-
2019
var toOriginal: SwiftUI.FullScreenToolbarBehavior {
2120
switch self {
2221
case .showsWithWindow: .showsWithWindow
@@ -60,68 +59,81 @@ public struct HiddenViewModifier<Content: View> {
6059
}
6160

6261
/// Adjust the padding around a Form with FormStyle `.grouped`
62+
@available(macOS 13.0, *)
6363
public func formInsets(_ edges: Edge.Set, _ value: CGFloat) -> some View {
6464
content.formInsets(edges, value)
6565
}
6666

6767
/// Adjust the padding around a Form with FormStyle `.grouped`
68+
@available(macOS 13.0, *)
6869
public func formInsets(_ edges: Edge.Set, _ value: EdgeInsets) -> some View {
6970
content.formInsets(edges, value)
7071
}
7172

7273
/// Adjust the inset of an individual row in a Form with FormStyle `.grouped`
74+
@available(macOS 13.0, *)
7375
public func formRowInsets(_ insets: EdgeInsets?) -> some View {
7476
content.formRowInsets(insets)
7577
}
7678

7779
/// Set the indentation level of a Form row.
80+
@available(macOS 13.0, *)
7881
public func formRowIndentationLevel(_ level: Int?) -> some View {
7982
content.formRowIndentationLevel(level)
8083
}
8184

8285
/// Change the background color of a Form.
86+
@available(macOS 13.0, *)
8387
public func formBackground<S: ShapeStyle>(_ shape: S?) -> some View {
8488
content.formBackground(shape)
8589
}
8690

8791
/// Change the background color of an individual row in a Form.
92+
@available(macOS 13.0, *)
8893
public func formRowBackground<S: ShapeStyle>(_ shape: S?) -> some View {
8994
content.formRowBackground(shape)
9095
}
9196

9297
/// Change the background color of a section.
98+
@available(macOS 13.0, *)
9399
public func sectionBackground(_ visibility: Visibility) -> some View {
94100
content.sectionBackground(visibility)
95101
}
96102

97103
/// Add a trailing info icon to a Form row.
98104
/// As an example, see system bluetooth settings.
105+
@available(macOS 13.0, *)
99106
public func formInfoAction(action: @escaping () -> Void) -> some View {
100107
content.formInfoAction(action: action)
101108
}
102109

103110
/// Change the visibility of the trailing info icon in a Form row.
111+
@available(macOS 13.0, *)
104112
public func formRowInfoVisibility(_ visibility: Visibility) -> some View {
105113
content.formRowInfoVisibility(visibility)
106114
}
107115

108116
/// Add a trailing Form row view, which becomes visible when hovered over the row.
109117
/// As an example, see system wifi settings.
118+
@available(macOS 13.0, *)
110119
public func formAccessory(@ViewBuilder accessories: () -> some View) -> some View {
111120
content.formAccessory(accessories: accessories)
112121
}
113122

114123
/// Change the visibility of the trailing Form row view.
124+
@available(macOS 13.0, *)
115125
public func formAccessoryVisibility(_ visibility: Visibility) -> some View {
116126
content.formAccessoryVisibility(visibility)
117127
}
118128

119129
/// Add a bottom row to a Form.
130+
@available(macOS 13.0, *)
120131
public func bottomBar(@ViewBuilder content: () -> some View) -> some View {
121132
self.content.bottomBar(content: content)
122133
}
123134

124135
/// Add a sticky footer to List or Table. The List or Table needs to be wrapped in a Form with style `grouped`.
136+
@available(macOS 13.0, *)
125137
public func accessoryBar(@ViewBuilder content: () -> some View) -> some View {
126138
self.content.accessoryBar(content: content)
127139
}

0 commit comments

Comments
 (0)