Skip to content

eonist/NetworkSugar

Repository files navigation

Reviewed by Hound

Network sugar

Sugar that makes swift networking less cumbersome

Installation

  • SPM: .package(url: "https://github.com/eonist/NetworkSugar.git", .branch("master"))

Example:

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

Todo:

  • Add github actions

About

Networking sugar

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages