Skip to content

Commit acd2d16

Browse files
committed
Update documentation
1 parent 35964d0 commit acd2d16

File tree

8 files changed

+34
-178
lines changed

8 files changed

+34
-178
lines changed

RELEASE_NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ SwiftUIKit makes its best effort to honor semver, but breaking changes can occur
44

55

66

7+
## 5.8.4
8+
9+
This version updates deprecation information for presentation types.
10+
11+
12+
713
## 5.8.3
814

915
This version deprecates list action types.

Sources/SwiftUIKit/_Deprecated/ListAction.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -132,20 +132,3 @@ private extension ListAction {
132132
#endif
133133
}
134134
}
135-
136-
#Preview {
137-
138-
@MainActor
139-
func view(for action: ListAction) -> some View {
140-
action.button
141-
}
142-
143-
return List {
144-
view(for: .call(phoneNumber: "abc123"))
145-
#if os(macOS) || os(iOS) || os(visionOS)
146-
view(for: .copy("abc123"))
147-
#endif
148-
view(for: .email(address: "abc123"))
149-
view(for: .openUrl("https://danielsaidi.com"))
150-
}
151-
}

Sources/SwiftUIKit/_Deprecated/Presentation/AlertContext.swift

Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,7 @@
99
import SwiftUI
1010

1111
/// This context can be used to present alerts.
12-
///
13-
/// To use this class, just create a `@StateObject` instance
14-
/// in your presenting view and bind the context to the view:
15-
///
16-
/// ```swift
17-
/// extension Alert {
18-
/// static let customAlert = Alert(title: "Hello, world!")
19-
/// }
20-
///
21-
/// struct MyView: View {
22-
///
23-
/// @StateObject var context = AlertContext()
24-
/// var body: some View {
25-
/// Button("Show alert") {
26-
/// context.present(.customAlert)
27-
/// }
28-
/// .alert(context)
29-
/// }
30-
/// }
31-
/// ```
32-
///
33-
/// This view modifier will also inject the provided context
34-
/// as an environment object into the view hierarchy, to let
35-
/// other views in the same hierarchy reuse the same context.
36-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
12+
@available(*, deprecated, message: "This has been moved to PresentationKit and renamed.")
3713
public class AlertContext: PresentationContext<Alert> {
3814

3915
@MainActor
@@ -45,8 +21,9 @@ public class AlertContext: PresentationContext<Alert> {
4521
}
4622

4723
public extension View {
48-
49-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
24+
25+
/// Bind an ``AlertContext`` to the view.
26+
@available(*, deprecated, message: "This has been moved to PresentationKit")
5027
func alert(_ context: AlertContext) -> some View {
5128
alert(
5229
isPresented: context.isActiveBinding,
@@ -56,32 +33,14 @@ public extension View {
5633
}
5734
}
5835

59-
/**
60-
This key can be used to keep track of the currently focused
61-
context within a multi-window app.
62-
63-
To apply it to a view, just use the `focusedValue` modifier
64-
with your context instance:
65-
66-
```swift
67-
.focusedValue(\.fullscreenCoverContext, context)
68-
```
69-
70-
To access the focus value, e.g. in a menu command, just use
71-
the `@FocusedValue` property wrapper:
72-
73-
```swift
74-
@FocusedValue(\.fullscreenCoverContext)
75-
var fullscreenCoverContext: FullscreenCoverContext?
76-
```
77-
*/
78-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
36+
/// This key can be used to keep track of the current value.
37+
@available(*, deprecated, message: "This has been moved to PresentationKit")
7938
public struct AlertContextFocusedValueKey: FocusedValueKey {
8039

8140
public typealias Value = AlertContext
8241
}
8342

84-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
43+
@available(*, deprecated, message: "This has been moved to PresentationKit")
8544
public extension FocusedValues {
8645

8746
var alertContext: AlertContextFocusedValueKey.Value? {

Sources/SwiftUIKit/_Deprecated/ErrorAlerter.swift renamed to Sources/SwiftUIKit/_Deprecated/Presentation/ErrorAlerter.swift

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,17 @@
88

99
import SwiftUI
1010

11-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
11+
@available(*, deprecated, message: "This has been moved to PresentationKit and renamed.")
1212
public protocol ErrorAlerter {
13-
13+
1414
var alert: AlertContext { get }
1515
}
1616

17-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
1817
@MainActor
18+
@available(*, deprecated, message: "This has been moved to PresentationKit and renamed.")
1919
public extension ErrorAlerter {
2020

21-
/**
22-
Alert the provided error.
23-
24-
If the error is an ``ErrorAlertConvertible``, then this
25-
presents its ``ErrorAlertConvertible/errorAlert``, else
26-
the error's `localizedDescription` is alerted.
27-
*/
21+
/// Alert the provided error.
2822
func alert(
2923
error: Error,
3024
okButtonText: String = "OK"
@@ -39,10 +33,6 @@ public extension ErrorAlerter {
3933
)
4034
)
4135
}
42-
}
43-
44-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
45-
public extension ErrorAlerter {
4636

4737
/// This typealias describes an async operation.
4838
typealias AsyncOperation = () async throws -> Void
@@ -57,7 +47,7 @@ public extension ErrorAlerter {
5747
typealias BlockOperation<ErrorType: Error> = (BlockCompletion<ErrorType>) -> Void
5848

5949
/// Alert the provided error asynchronously.
60-
@MainActor func alertAsync(
50+
func alertAsync(
6151
error: Error,
6252
okButtonText: String = "OK"
6353
) {
@@ -69,7 +59,7 @@ public extension ErrorAlerter {
6959

7060
/// Try to perform a block-based operation, and alert if
7161
/// this operation fails in any way.
72-
@MainActor func tryWithErrorAlert<ErrorType: Error>(
62+
func tryWithErrorAlert<ErrorType: Error>(
7363
_ operation: @escaping BlockOperation<ErrorType>,
7464
completion: @escaping BlockCompletion<ErrorType>
7565
) {
@@ -87,7 +77,7 @@ public extension ErrorAlerter {
8777
///
8878
/// This function wraps an async operation in a task and
8979
/// alerts any errors that are thrown.
90-
@MainActor func tryWithErrorAlert(_ operation: @escaping AsyncOperation) {
80+
func tryWithErrorAlert(_ operation: @escaping AsyncOperation) {
9181
Task {
9282
do {
9383
try await operation()

Sources/SwiftUIKit/_Deprecated/Presentation/FullScreenCoverContext.swift

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,7 @@
99
import SwiftUI
1010

1111
/// This context can be used to present full screen covers.
12-
///
13-
/// To use this class, just create a `@StateObject` instance
14-
/// in your presenting view and bind the context to the view:
15-
///
16-
/// ```swift
17-
/// struct MyView: View {
18-
///
19-
/// @StateObject var context = FullScreenCoverContext()
20-
///
21-
/// var body: some View {
22-
/// Button("Show cover") {
23-
/// context.present(Text("Hello, world!"))
24-
/// }
25-
/// .fullScreenCover(context)
26-
/// }
27-
/// }
28-
/// ```
29-
///
30-
/// This view modifier will also inject the provided context
31-
/// as an environment object into the view hierarchy, to let
32-
/// other views in the same hierarchy reuse the same context.
33-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
12+
@available(*, deprecated, message: "This has been moved to PresentationKit and renamed.")
3413
public class FullScreenCoverContext: PresentationContext<AnyView> {
3514

3615
@MainActor
@@ -46,10 +25,8 @@ import SwiftUI
4625

4726
public extension View {
4827

49-
/// Bind an ``FullScreenCoverContext`` to the view.
50-
///
51-
/// This also injects this context as environment object.
52-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
28+
/// Bind a ``FullScreenCoverContext`` to the view.
29+
@available(*, deprecated, message: "This has been moved to PresentationKit")
5330
func fullScreenCover(
5431
_ context: FullScreenCoverContext
5532
) -> some View {
@@ -62,32 +39,15 @@ public extension View {
6239
}
6340
#endif
6441

65-
/**
66-
This key can be used to keep track of the currently focused
67-
context within a multi-window app.
6842

69-
To apply it to a view, just use the `focusedValue` modifier
70-
with your context instance:
71-
72-
```swift
73-
.focusedValue(\.fullscreenCoverContext, context)
74-
```
75-
76-
To access the focus value, e.g. in a menu command, just use
77-
the `@FocusedValue` property wrapper:
78-
79-
```swift
80-
@FocusedValue(\.fullscreenCoverContext)
81-
var fullscreenCoverContext: FullscreenCoverContext?
82-
```
83-
*/
84-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
43+
/// This key can be used to keep track of the current value.
44+
@available(*, deprecated, message: "This has been moved to PresentationKit")
8545
public struct FullScreenCoverContextFocusedValueKey: FocusedValueKey {
8646

8747
public typealias Value = FullScreenCoverContext
8848
}
8949

90-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
50+
@available(*, deprecated, message: "This has been moved to PresentationKit")
9151
public extension FocusedValues {
9252

9353
var fullScreenCoverContext: FullScreenCoverContextFocusedValueKey.Value? {

Sources/SwiftUIKit/_Deprecated/Presentation/PresentationContext.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import SwiftUI
1818
///
1919
/// You can also setup a global context and pass it into the
2020
/// view hierarchy as an environment object.
21-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
21+
@available(*, deprecated, message: "This has been moved to PresentationKit and renamed.")
2222
open class PresentationContext<Content>: ObservableObject {
2323

2424
public init() {}
@@ -33,7 +33,7 @@ open class PresentationContext<Content>: ObservableObject {
3333
}
3434

3535
@MainActor
36-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
36+
@available(*, deprecated, message: "This has been moved to PresentationKit")
3737
public extension PresentationContext {
3838

3939
var isActiveBinding: Binding<Bool> {

Sources/SwiftUIKit/_Deprecated/Presentation/SheetContext.swift

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,8 @@
88

99
import SwiftUI
1010

11-
/**
12-
This context can be used to present sheets in a dynamic way.
13-
14-
To use this class, just create a `@StateObject` instance in
15-
your presenting view and bind the context to that view:
16-
17-
```swift
18-
struct MyView: View {
19-
20-
@StateObject var context = SheetContext()
21-
22-
var body: some View {
23-
Button("Show sheet") {
24-
context.present(Text("Hello, world!"))
25-
}
26-
.sheet(context)
27-
}
28-
}
29-
```
30-
31-
This view modifier will also inject the provided context as
32-
an environment object into the view hierarchy, to let other
33-
views in the same view hierarchy reuse the same context.
34-
*/
35-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
11+
/// This context can be used to present sheets.
12+
@available(*, deprecated, message: "This has been moved to PresentationKit and renamed.")
3613
public class SheetContext: PresentationContext<AnyView> {
3714

3815
@MainActor
@@ -41,12 +18,10 @@ public class SheetContext: PresentationContext<AnyView> {
4118
}
4219
}
4320

44-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
21+
@available(*, deprecated, message: "This has been moved to PresentationKit")
4522
public extension View {
4623

47-
/// Bind an ``SheetContext`` to the view.
48-
///
49-
/// This also injects this context as environment object.
24+
/// Bind a ``SheetContext`` to the view.
5025
func sheet(_ context: SheetContext) -> some View {
5126
sheet(
5227
isPresented: context.isActiveBinding,
@@ -56,26 +31,9 @@ public extension View {
5631
}
5732
}
5833

59-
/**
60-
This key can be used to keep track of the currently focused
61-
context within a multi-window app.
62-
63-
To apply it to a view, just use the `focusedValue` modifier
64-
with your context instance:
6534

66-
```swift
67-
.focusedValue(\.sheetContext, context)
68-
```
69-
70-
To access the focus value, e.g. in a menu command, just use
71-
the `@FocusedValue` property wrapper:
72-
73-
```swift
74-
@FocusedValue(\.sheetContext)
75-
private var sheetContext: SheetContext?
76-
```
77-
*/
78-
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
35+
/// This key can be used to keep track of the current value.
36+
@available(*, deprecated, message: "This has been moved to PresentationKit")
7937
public struct SheetContextFocusedValueKey: FocusedValueKey {
8038

8139
public typealias Value = SheetContext

0 commit comments

Comments
 (0)