Skip to content

Commit 9b479c0

Browse files
committed
Deprecate error alerter
1 parent a0011c2 commit 9b479c0

File tree

6 files changed

+10
-29
lines changed

6 files changed

+10
-29
lines changed

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ SwiftUIKit makes its best effort to honor semver, but breaking changes can occur
1313
### 🗑️ Deprecations
1414

1515
* `AlertContext` has been moved to https://github.com/danielsaidi/PresentationKit.
16+
* `ErrorAlerter` has been moved to https://github.com/danielsaidi/PresentationKit.
1617
* `FullScreenCoverContext` has been moved to https://github.com/danielsaidi/PresentationKit.
1718
* `Image+ScanCode` has been moved to https://github.com/danielsaidi/ScanCodes.
1819
* `LinkText` has been moved to https://github.com/danielsaidi/TextReplacements.
@@ -22,6 +23,7 @@ SwiftUIKit makes its best effort to honor semver, but breaking changes can occur
2223
* `PresentationContext` has been moved to https://github.com/danielsaidi/PresentationKit.
2324
* `ScanCodeType` has been moved to https://github.com/danielsaidi/ScanCodes.
2425
* `SheetContext` has been moved to https://github.com/danielsaidi/PresentationKit.
26+
* `UrlSharing` has been deprecated.
2527

2628

2729

Sources/SwiftUIKit/SwiftUIKit.docc/SwiftUIKit.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ SwiftUIKit is available under the MIT license.
6767

6868
- ``DeviceIdentifier``
6969

70-
### Errors
71-
72-
- ``ErrorAlerter``
73-
- ``ErrorAlertConvertible``
74-
7570
### Files
7671

7772
- ``BundleFileFinder``

Sources/SwiftUIKit/Errors/ErrorAlertConvertible.swift renamed to Sources/SwiftUIKit/_Deprecated/ErrorAlertConvertible.swift

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

99
import SwiftUI
1010

11-
/**
12-
This protocol can be implemented by error types that can be
13-
used together with an ``ErrorAlerter``.
14-
15-
This makes it possible to specify display content for error
16-
types that are meant to be presented to users.
17-
*/
11+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
1812
public protocol ErrorAlertConvertible: Error {
1913

2014
/// The title to display in the alert.
@@ -27,6 +21,7 @@ public protocol ErrorAlertConvertible: Error {
2721
var errorButtonText: String { get }
2822
}
2923

24+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
3025
public extension ErrorAlertConvertible {
3126

3227
/// Create an error `Alert`.

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,13 @@
88

99
import SwiftUI
1010

11-
/**
12-
This protocol can be implemented by anything that can alert
13-
errors, e.g. a view that performs a throwing async function.
14-
15-
By implementing the protocol, types get access to new alert
16-
functions as well as the convenient ``tryWithErrorAlert(_:)``
17-
function, that makes it possible to trigger async functions
18-
and alert any errors that occur.
19-
20-
If you throw errors that conform to ``ErrorAlertConvertible``
21-
you get full control over what's alerted.
22-
*/
11+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
2312
public protocol ErrorAlerter {
2413

2514
var alert: AlertContext { get }
2615
}
2716

17+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
2818
@MainActor
2919
public extension ErrorAlerter {
3020

@@ -51,6 +41,7 @@ public extension ErrorAlerter {
5141
}
5242
}
5343

44+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/PresentationKit")
5445
public extension ErrorAlerter {
5546

5647
/// This typealias describes an async operation.

Sources/SwiftUIKit/Sharing/UrlSharing.swift renamed to Sources/SwiftUIKit/_Deprecated/UrlSharing.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99
#if os(iOS)
1010
import SwiftUI
1111

12-
/**
13-
This protocol can be implemented by any view that can share
14-
a url, using a certain ``UrlSharing/sheet``.
15-
*/
12+
@available(*, deprecated, message: "Use ShareSheet directly instead.")
1613
public protocol UrlSharing: View {
1714

1815
var sheet: SheetContext { get }
1916
}
2017

18+
@available(*, deprecated, message: "Use ShareSheet directly instead.")
2119
public extension UrlSharing {
2220

2321
/// Share the provided url using a ``ShareSheet``.

Tests/SwiftUIKitTests/Data/StorageCodableTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class AppStorageCodableTests: XCTestCase {
3939
XCTAssertNil(state1.object)
4040
state1.object = .init(value)
4141
let state2 = MyState()
42-
XCTAssertEqual(state2.object?.value.name, "Daniel")
42+
XCTAssertEqual(state2.object?.value?.name, "Daniel")
4343
state2.object = nil
4444
}
4545

0 commit comments

Comments
 (0)