https://github.com/hooliooo/astral
An HTTP networking library that emphasizes ease of use and ergonomics. Based on Rust's reqwest library
https://github.com/hooliooo/astral
http ios networking swift
Last synced: 27 days ago
JSON representation
An HTTP networking library that emphasizes ease of use and ergonomics. Based on Rust's reqwest library
- Host: GitHub
- URL: https://github.com/hooliooo/astral
- Owner: hooliooo
- License: mit
- Created: 2017-05-21T09:15:39.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2025-05-30T08:13:36.000Z (10 months ago)
- Last Synced: 2025-06-29T00:03:33.271Z (9 months ago)
- Topics: http, ios, networking, swift
- Language: Swift
- Homepage:
- Size: 1.33 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Support: Supporting Files/Astral.h
Awesome Lists containing this project
README
# Astral
Astral is a minimal HTTP Networking library that aims to simplify an application's networking layer by abstracting
the steps needed to create a network request into an easy to use API. Astral uses Swift's async/await concurrency features.
## Requirements
Astral requires Swift 5.6
## Installation
### [CocoaPods](http://cocoapods.org/)
1. Add the following to your [Podfile](http://guides.cocoapods.org/using/the-podfile.html):
```ruby
pod 'Astral'
```
2. Integrate your dependencies using frameworks: add `use_frameworks!` to your Podfile.
3. Run `pod install`.
### [Carthage](https://github.com/Carthage/Carthage)
Add the following to your Cartfile:
```
github "hooliooo/Astral"
```
### [Swift Package Manager](https://swift.org/package-manager/)
Add the following dependency in your Package.swift file:
```
.package(url: "https://github.com/hooliooo/Astral.git", from: "3.0.0")
```
## A Simple Example
Here's an example using the [Pokemon API](http://pokeapi.co)
```swift
class PokemonAPIClient {
let client: Client = Client()
private let baseURL: String = "https://pokeapi.co/api/v2"
func getPokemon(id: Int) async throws -> (Pokemon, URLResponse) {
return try await client
.get("\(self.baseURL)/pokemon/\(id)")
.headers(
headers: [
Header(key: Header.Key.accept, value: Header.Value.mediaType(.applicationJSON)),
]
)
.send()
}
}
```
## Author
[Julio Alorro](https://twitter.com/Hooliooo)
## License
Astral is available under the MIT license. See the LICENSE file for more info.