Skip to content

Commit 58dcd09

Browse files
committed
fix existential any
1 parent fd97438 commit 58dcd09

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

Diff for: Source/Shared/Library/ImageWrapper.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public struct ImageWrapper: Codable {
1515
self.image = image
1616
}
1717

18-
public init(from decoder: Decoder) throws {
18+
public init(from decoder: any Decoder) throws {
1919
let container = try decoder.container(keyedBy: CodingKeys.self)
2020
let data = try container.decode(Data.self, forKey: CodingKeys.image)
2121
guard let image = Image(data: data) else {
@@ -25,7 +25,7 @@ public struct ImageWrapper: Codable {
2525
self.image = image
2626
}
2727

28-
public func encode(to encoder: Encoder) throws {
28+
public func encode(to encoder: any Encoder) throws {
2929
var container = encoder.container(keyedBy: CodingKeys.self)
3030
guard let data = image.cache_toData() else {
3131
throw StorageError.encodingFailed

Diff for: Source/Shared/Library/JSONArrayWrapper.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public struct JSONArrayWrapper: Codable {
1313
self.jsonArray = jsonArray
1414
}
1515

16-
public init(from decoder: Decoder) throws {
16+
public init(from decoder: any Decoder) throws {
1717
let container = try decoder.container(keyedBy: CodingKeys.self)
1818
let data = try container.decode(Data.self, forKey: CodingKeys.jsonArray)
1919
let object = try JSONSerialization.jsonObject(
@@ -28,7 +28,7 @@ public struct JSONArrayWrapper: Codable {
2828
self.jsonArray = jsonArray
2929
}
3030

31-
public func encode(to encoder: Encoder) throws {
31+
public func encode(to encoder: any Encoder) throws {
3232
var container = encoder.container(keyedBy: CodingKeys.self)
3333
let data = try JSONSerialization.data(
3434
withJSONObject: jsonArray,

Diff for: Source/Shared/Library/JSONDictionaryWrapper.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public struct JSONDictionaryWrapper: Codable {
1313
self.jsonDictionary = jsonDictionary
1414
}
1515

16-
public init(from decoder: Decoder) throws {
16+
public init(from decoder: any Decoder) throws {
1717
let container = try decoder.container(keyedBy: CodingKeys.self)
1818
let data = try container.decode(Data.self, forKey: CodingKeys.jsonDictionary)
1919
let object = try JSONSerialization.jsonObject(
@@ -28,7 +28,7 @@ public struct JSONDictionaryWrapper: Codable {
2828
self.jsonDictionary = jsonDictionary
2929
}
3030

31-
public func encode(to encoder: Encoder) throws {
31+
public func encode(to encoder: any Encoder) throws {
3232
var container = encoder.container(keyedBy: CodingKeys.self)
3333
let data = try JSONSerialization.data(
3434
withJSONObject: jsonDictionary,

Diff for: Source/Shared/Library/Optional+Extension.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
public extension Optional {
4-
func unwrapOrThrow(error: Error) throws -> Wrapped {
4+
func unwrapOrThrow(error: any Error) throws -> Wrapped {
55
if let value = self {
66
return value
77
} else {

Diff for: Source/Shared/Storage/AsyncStorage.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class AsyncStorage<Key: Hashable, Value> {
1414
}
1515

1616
extension AsyncStorage {
17-
public func entry(forKey key: Key, completion: @escaping (Result<Entry<Value>, Error>) -> Void) {
17+
public func entry(forKey key: Key, completion: @escaping (Result<Entry<Value>, any Error>) -> Void) {
1818
serialQueue.async { [weak self] in
1919
guard let `self` = self else {
2020
completion(.failure(StorageError.deallocated))
@@ -30,7 +30,7 @@ extension AsyncStorage {
3030
}
3131
}
3232

33-
public func removeObject(forKey key: Key, completion: @escaping (Result<(), Error>) -> Void) {
33+
public func removeObject(forKey key: Key, completion: @escaping (Result<(), any Error>) -> Void) {
3434
serialQueue.async { [weak self] in
3535
guard let `self` = self else {
3636
completion(.failure(StorageError.deallocated))
@@ -50,7 +50,7 @@ extension AsyncStorage {
5050
_ object: Value,
5151
forKey key: Key,
5252
expiry: Expiry? = nil,
53-
completion: @escaping (Result<(), Error>) -> Void) {
53+
completion: @escaping (Result<(), any Error>) -> Void) {
5454
serialQueue.async { [weak self] in
5555
guard let `self` = self else {
5656
completion(.failure(StorageError.deallocated))
@@ -66,7 +66,7 @@ extension AsyncStorage {
6666
}
6767
}
6868

69-
public func removeAll(completion: @escaping (Result<(), Error>) -> Void) {
69+
public func removeAll(completion: @escaping (Result<(), any Error>) -> Void) {
7070
serialQueue.async { [weak self] in
7171
guard let `self` = self else {
7272
completion(.failure(StorageError.deallocated))
@@ -82,7 +82,7 @@ extension AsyncStorage {
8282
}
8383
}
8484

85-
public func removeExpiredObjects(completion: @escaping (Result<(), Error>) -> Void) {
85+
public func removeExpiredObjects(completion: @escaping (Result<(), any Error>) -> Void) {
8686
serialQueue.async { [weak self] in
8787
guard let `self` = self else {
8888
completion(.failure(StorageError.deallocated))
@@ -98,7 +98,7 @@ extension AsyncStorage {
9898
}
9999
}
100100

101-
public func object(forKey key: Key, completion: @escaping (Result<Value, Error>) -> Void) {
101+
public func object(forKey key: Key, completion: @escaping (Result<Value, any Error>) -> Void) {
102102
entry(forKey: key, completion: { (result: Result<Entry<Value>, Error>) in
103103
completion(result.map({ entry in
104104
return entry.object
@@ -109,7 +109,7 @@ extension AsyncStorage {
109109
@available(*, deprecated, renamed: "objectExists(forKey:completion:)")
110110
public func existsObject(
111111
forKey key: Key,
112-
completion: @escaping (Result<Bool, Error>) -> Void) {
112+
completion: @escaping (Result<Bool, any Error>) -> Void) {
113113
object(forKey: key, completion: { (result: Result<Value, Error>) in
114114
completion(result.map({ _ in
115115
return true
@@ -119,7 +119,7 @@ extension AsyncStorage {
119119

120120
public func objectExists(
121121
forKey key: Key,
122-
completion: @escaping (Result<Bool, Error>) -> Void) {
122+
completion: @escaping (Result<Bool, any Error>) -> Void) {
123123
object(forKey: key, completion: { (result: Result<Value, Error>) in
124124
completion(result.map({ _ in
125125
return true

0 commit comments

Comments
 (0)