Depo is a universal dependency manager that combines Carthage, SPM and CocoaPods and provides common user interface to all of them.
To install Networking
via Carthage using Depo you need to add this to your Depofile
:
carts:
- kind: github
identifier: rosberry/Networking-iOS
Add this to your Depofile:
swiftPackages:
- name: Networking-iOS
url: https://github.com/rosberry/Networking-iOS.git
version:
operation: upToNextMajor
value: 1.0.0
Add this to your Depofile:
pods:
- name: Networking
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Networking into your Xcode project using Carthage, specify it in your Cartfile
:
github "rosberry/Networking-iOS"
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Networking into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'Networking'
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler. Once you have your Swift package set up, adding Networking as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/rosberry/Networking-iOS.git", .upToNextMajor(from: "1.0.0"))
]
Lightweight framework for working with network layer based on URLSession
.
Features:
Endpoint
Create your own Endpoint
import Foundation
import Networking
enum JokesEndpoint: Endpoint {
case random(category: String)
var baseURL: URL {
URL(string: "https://official-joke-api.appspot.com/jokes")!
}
var path: String {
"random"
}
}
Use RequestService
to execute request with endpoint
import Foundation
import Networking
final class JokesServiceImp: RequestService, JokesService {
private init() {
super.init()
decoder.keyDecodingStrategy = .convertFromSnakeCase
}
func loadRandomJoke(category: String, completion: @escaping ResultCompletion<Joke>) {
request(JokesEndpoint.random(category: category)) { result in
completion(result)
}
}
}
This project is owned and maintained by Rosberry. We build mobile apps for users worldwide 🌏.
Check out our open source projects, read our blog or give us a high-five on 🐦 @rosberryapps.
This project is available under the MIT license. See the LICENSE file for more info.
link |
Stars: 1 |
Last commit: 2 years ago |
Fix carthage build
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics