Add first source scanning
This commit is contained in:
8
WebsiteGenerator/Extensions/Decodable+Extensions.swift
Normal file
8
WebsiteGenerator/Extensions/Decodable+Extensions.swift
Normal 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)
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user