This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
extension XCTest { | |
func loadFromJSON<T: Codable>(jsonFileName filename: String) -> T? { | |
guard let url = Bundle(for: type(of: self)).url(forResource: filename, withExtension: "json") else { | |
XCTFail("Unable to read \(filename) from stub") | |
return nil | |
} | |
do { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// abey.dev | |
import Foundation | |
extension Array { | |
func decompose() -> (Iterator.Element, [Iterator.Element])? { | |
guard let x = first else { return nil } | |
return (x, Array(self[1..<count])) | |
} | |
} |