Zen, Zero Effort Networking
Zen is simple yet powerfull Networking library for iOS. It leverage the powerfull feature of Alamofire and Swift to make building Network Layer more straight forward and efficient.
Requirements
- Xcode 11.3+
- Swift 5.1+
- iOS 13+
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Zen into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'Zen', '~> 0.1.1'
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Zen into your Xcode project using Carthage, specify it in your Cartfile
:
github "KarimEbrahemAbdelaziz/Zen" ~> 0.1.1
SPM
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler. It is in early development, but Zen does support its use on supported platforms.
Once you have your Swift package set up, adding Zen as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/KarimEbrahemAbdelaziz/Zen.git", .upToNextMajor(from: "0.1.1"))
]
Usage
Create your Model (Must Conform to Codable)
struct Todo: Codable {
var userId: Int
var id: Int
var title: String
var completed: Bool
}
🔥
Create your API Client import Zen
class APIClient {
@GET<[Todo]>(url: "https://jsonplaceholder.typicode.com/todos")
static var fetchTodos: Service<[Todo]>
}
🤓
Use it APIClient.fetchTodos { result in
print(result)
}
Todo
- Support all HTTP Methods Requests.
- Support Body Parameters.
- Support Query Parameters.
- Support Headers.
- Support Interceptors.
Author
Karim Ebrahem, karimabdelazizmansour@gmail.com You can find me on Twitter @k_ebrahem_.
License
Zen is available under the MIT license. See the LICENSE
file for more info.
Zen will be updated when necessary and fixes will be done as soon as discovered to keep it up to date.
Enjoy!