Add first source scanning

This commit is contained in:
Christoph Hagen
2022-08-19 18:05:06 +02:00
parent 7fe1865dfd
commit 06daa5e5fa
17 changed files with 1287 additions and 5 deletions

View File

@ -0,0 +1,8 @@
import Foundation
extension JSONDecoder {
func decode<T>(from data: Data) throws -> T where T: Decodable {
try self.decode(T.self, from: data)
}
}

View File

@ -9,4 +9,20 @@ extension Optional {
}
return nil
}
@discardableResult
func ifNil(_ closure: () -> Void) -> Self {
if self == nil {
closure()
}
return self
}
@discardableResult
func ifNotNil(_ closure: () -> Void) -> Self {
if self != nil {
closure()
}
return self
}
}