A tiny network library to fetch Decodable
Resources or Images.
We currently support Swift Package Manager
Add TinyNetwork as a dependency to your Package.swift file. For more information, see the Swift Package Manager documentation.
.package(url: "https://github.com/mrgrauel/TinyNetwork.git", from: "1.0.0")
var cancellable = Set<AnyCancellable>()
public struct Mock: Decodable {
public let name: String
}
let url = URL(string: "https://test.com/mock")!
let request = Request<MockResource>(
url: url,
method: .get([
.init(name: "foobar", value: "1"),
.init(name: "barfoo", value: "2")
])
)
URLSession.shared.publisher(for: request)
.sink(
receiveCompletion: { completion in
print(completion)
},
receiveValue: { value in
print(value)
}
)
.store(in: &cancellable)
- Open an issue if you need help, if you found a bug, or if you want to discuss a feature request.
- Open a PR if you want to make some change to
TinyNetwork
. - Contact @mrgrauel on Twitter.