1801584810_2
This file contains 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
extension Query { | |
static func decodeResponse(_ data: Data) throws -> Response { | |
JSONDecoder().decode(Response.self, from: data) | |
} | |
// The query file on disk | |
var body: String { | |
// Assume it has the same name as the query type | |
try! String(contentsOfFile: Bundle.main.path(forResource: String("\(type(of: self))".split(separator: ".").last!), ofType: "query")!) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment