Lightweight ReactiveSwift dynamically configurable network layer.
This small library provides solution for most modern Swift application's networking needs. It designed to be dependable on application user's state, dynamically changing it's configuration and request parameters on user authorization or other environment changes. Information exchange – encoding of outgoing data, setting of corresponding request headers, checking response code, decoding received data – is done through single method.
Making a request would be as simple as:
Server.back
.request(
type: .post,
path: "/ping"
)
.start()
Or as complex as:
Server.back
.request(
type: .post,
path: "/userinfo",
query: [
"id": userID,
],
send: .multipart([
.png(avatarImage, name: "avatar", filename: "avatar.png"),
.text(firstName, name: "first_name"),
.text(lastName, name: "last_name"),
]),
take: .json(UserCard.self)
)
.reportError(title: "Can't update user card")
.observe(on: QueueScheduler.main)
.startWithValues { userCard in
// process updated user card
}
Complete Xcode documentation is included with code and its archived version attached to GitHub release page.
Documentation is also available online.
link |
Stars: 4 |
Last commit: 1 week ago |
– URLSession
moved into Config
structure.
– Server.assets
replaced by Server.config
.
– SessionConfiguration
replaced with direct use of URLSessionConfiguration
.
– Session configuration and authentication challenge handler are no longer stored in Config
.
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics