Sugar that makes swift networking less cumbersome
- SPM:
.package(url: "https://github.com/eonist/NetworkSugar.git", .branch("master"))
let urlStr: String = "https://github.com/stylekit/img/blob/master/playlist.json?raw=true"
// Longhand:
NetworkParser.str(urlStr: urlStr) { result in
if case .success(let string) = result {
Swift.print("str: \(str)")
} else if case .failure(let error) = result {
Swift.print("error: \(String(describing: error))")
}
}
// Shorthand:
NetworkParser.str(urlStr: webPath) { print(try? $0.get()) } // The JSON payload
- Add github actions