Skip to content

Commit 017a0b5

Browse files
unnameddthomaspaulmann
authored andcommitted
Move extensions to a proper folder
1 parent a1d4d79 commit 017a0b5

16 files changed

+24
-1
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// MIT License
3+
// Copyright (c) 2020-2021 Raycast. All rights reserved.
4+
//
5+
6+
import Foundation
7+
8+
extension Array where Element == Metadata {
9+
func hasIdentifier(_ identifier: Identifier) -> Bool {
10+
var foundValue = false
11+
12+
for item in self {
13+
foundValue = item.identifiers.first(where: { $0 == identifier }) != nil
14+
}
15+
16+
return foundValue
17+
}
18+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Tools/Toolkit/Sources/ToolkitLibrary/Extensions/Data+Decodable.swift renamed to Tools/Toolkit/Sources/ToolkitLibrary/Extensions/Data/Data+Decodable.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import Foundation
88
extension Data {
99
func decode<T: Codable>(_ type: T.Type = T.self) throws -> T {
1010
let decoder = JSONDecoder()
11+
decoder.dateDecodingStrategy = .iso8601
12+
1113
let object = try decoder.decode(type, from: self)
1214

1315
return object

Tools/Toolkit/Sources/ToolkitLibrary/Extensions/Dictionary+Codable.swift renamed to Tools/Toolkit/Sources/ToolkitLibrary/Extensions/Dictionary/Dictionary+Codable.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ extension Dictionary where Key == String, Value: Any {
1212
withJSONObject: self
1313
)
1414

15-
return try JSONDecoder().decode(T.self, from: data)
15+
let decoder = JSONDecoder()
16+
decoder.dateDecodingStrategy = .iso8601
17+
18+
return try decoder.decode(T.self, from: data)
1619
}
1720
catch {
1821
return nil
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)