APIKit is a type-safe networking abstraction layer that associates request type with response type.
// SearchRepositoriesRequest conforms to Request protocol.
let request = SearchRepositoriesRequest(query: "swift")
// Session receives an instance of a type that conforms to Request.
Session.send(request) { result in
switch result {
case .success(let response):
// Type of `response` is `[Repository]`,
// which is inferred from `SearchRepositoriesRequest`.
print(response)
case .failure(let error):
self.printError(error)
}
}
If you use Swift 2.2 or 2.3, try APIKit 2.0.5.
If you use Swift 4.2 or before, try APIKit 4.1.0.
If you use Swift 5.2 or before, try APIKit 5.3.0.
github "ishkawa/APIKit" ~> 5.0
to your Cartfile.carthage update
.APIKit.framework
in Carthage/Build
.pod 'APIKit', '~> 5.0'
to your Podfile.pod install
.Note: CocoaPods 1.4.0 is required to install APIKit 5.
link |
Stars: 1989 |
Last commit: 1 year ago |
class
keyword #297response(from:urlResponse:)
when Response is Void #304Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics