Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/0xopenbytes/network
πΈοΈ Output and Input for remote URLs using REST
https://github.com/0xopenbytes/network
async-await datatask get headers network post rest swift url urlsession
Last synced: about 20 hours ago
JSON representation
πΈοΈ Output and Input for remote URLs using REST
- Host: GitHub
- URL: https://github.com/0xopenbytes/network
- Owner: 0xOpenBytes
- License: mit
- Created: 2023-03-07T00:35:51.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T15:57:19.000Z (almost 2 years ago)
- Last Synced: 2024-05-02T06:02:27.023Z (8 months ago)
- Topics: async-await, datatask, get, headers, network, post, rest, swift, url, urlsession
- Language: Swift
- Homepage: https://0xopenbytes.github.io/Network/
- Size: 3.91 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Network
Network is a convenience typealias for `o.url` that represents network access. `o.url` is a group of functions in the `o` module that provides network access and manipulation operations.
## Usage
To use `Network`, simply import `Network` and use the `Network` typealias in your code:```swift
import Network// Get data from a URL
let data = try await Network.get(url: URL(string: "https://example.com/data.json")!)// Post data to a URL
let postData = "Hello, world!".data(using: .utf8)!
try await Network.post(url: URL(string: "https://example.com/post")!, body: postData)
```