https://github.com/mrgrauel/tinynetwork
Minimalistic Network Library
https://github.com/mrgrauel/tinynetwork
codable ios json network swift urlsession watchos xcode
Last synced: 9 months ago
JSON representation
Minimalistic Network Library
- Host: GitHub
- URL: https://github.com/mrgrauel/tinynetwork
- Owner: mrgrauel
- License: mit
- Created: 2020-11-25T11:54:52.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-08-02T13:49:28.000Z (over 1 year ago)
- Last Synced: 2025-03-11T20:37:24.304Z (about 1 year ago)
- Topics: codable, ios, json, network, swift, urlsession, watchos, xcode
- Language: Swift
- Homepage:
- Size: 56.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TinyNetwork
![badge-mit][] ![badge-languages][] ![badge-pms][] ![badge-platforms][]
A tiny network library to fetch `Decodable` Resources or Images.
## Getting Started
We currently support [Swift Package Manager](https://swift.org/package-manager/)
### Swift Package Manager
Add **TinyNetwork** as a dependency to your Package.swift file. For more information, see the [Swift Package Manager documentation](https://github.com/apple/swift-package-manager/tree/master/Documentation).
```swift
.package(url: "https://github.com/mrgrauel/TinyNetwork.git", from: "1.0.0")
```
### Example
```swift
var cancellable = Set()
public struct Mock: Decodable {
public let name: String
}
let url = URL(string: "https://test.com/mock")!
let request = Request(
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)
```
## Help & Feedback
* [Open an issue](https://github.com/mrgrauel/TinyNetwork/issues/new) if you need help, if you found a bug, or if you want to discuss a feature request.
* [Open a PR](https://github.com/mrgrauel/TinyNetwork/pull/new/master) if you want to make some change to `TinyNetwork`.
* Contact [@mrgrauel](https://twitter.com/mrgrauel) on Twitter.
[badge-pms]: https://img.shields.io/badge/supports-SwiftPM-green.svg
[badge-languages]: https://img.shields.io/badge/languages-Swift-orange.svg
[badge-platforms]: https://img.shields.io/badge/platforms-iOS%20%7C%20watchOS-lightgrey.svg
[badge-mit]: https://img.shields.io/badge/license-MIT-blue.svg