URLExpress is a framework built on top of URLSession to enable declarative syntax for URLRequests to reduce unwanted mutability and increase readability.
- Declarative Syntax
- URL / JSON Parameter Encoding
- Multipart Request Support
- Easy Access for request's headers and parameters
- Combine Support
- Support for iOS 13.0+
- Compatibility for Cocoapods and Swift Package Manager
- RxSwift support (coming soon)
- Tracking Upload/Download Progress
- HTTP Response Validation
- Network Reachability
- iOS 13.0 or higher
- If you're using reactive programming, stick with Combine for now.
- Support for RxSwift will be added in the future.
URLExpress is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'URLExpress'
-
You can access the package manager interface from
File
>Add Package
and copying the repository link to the search barhttps://github.com/ahmedfathy-m/URLExpress.git
and pressAdd Package
when you're done -
Alternatively, you can add URLExpress as a dependency by adding it to the
dependencies
value of yourPackage.swift
.
dependencies: [
.package(url: "https://github.com/ahmedfathy-m/URLExpress.git", .upToNextMajor(from: "0.1.0"))
]
URLExpress allows you to chain multiple commands as you would in Combine or SwiftUI to produce declarative code that reduces unwanted mutability and side effects.
URL(domain: "https://dummyjson.com", path: "auth/login")!
.makeRequest(with: .post)
.appendingTextField("username", value: "kminchelle")
.appendingTextField("password", value: "0lelplR")
.withContentType(.json)
.withAcceptType(.json)
.decodeJSONOnReceive(for: Login.self)
.send {
print($0)
} success: {
print("Welcome, \($0.firstName) \($0.lastName)")
}
For detailed instructions on how to use URLExpress in multiple case check the documentation.
- URLExpress is developed and maintained by me personally.
- If you have any questions or suggestions about URLExpress, don't hesitate to send me an email: ahmedfathy.mha@gmail.com
URLExpress is available under the MIT license. See the LICENSE file for more info.