Latest 2.1.0
License MIT
Platforms ios 8.0, osx 10.10, watchos 2.0, tvos 9.0





TinyNetworking is a simple network abstraction layer written in Swift.

  • 🌯 Just a thin wrapper around NSURLSession.
  • ✌️ Supports CRUD methods.
  • 🚦 Compile-time checking for correct API endpoint accesses.
  • 🐍 (Optional) RxSwift extensions to the API.
  • ❤️ Inspired by Moya.
  • 🎉 No external dependencies.

🛠 Installation


To integrate TinyNetworking into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'TinyNetworking'


pod 'TinyNetworking/RxSwift' # for the RxSwift extentions

Then, run the following command:

$ pod install


Comming Soon

Swift Package Manager

Comming Soon


If you prefer not to use any of the dependency managers, you can integrate TinyNetworking into your project manually, by downloading the source code and placing the files on your project directory.

👨🏻‍💻 Usage

Set up an enum with all of your API resources like this example:

enum Unsplash {
  case me
  case photo(id: String)
  case collection(id: String)
  case likePhoto(id: String)

Extend enum and confom to ResourceType protocol.

extension Unsplash: ResourceType {
  var baseURL: URL {
    guard let url = URL(string: "") else {
    return url

  var endpoint: String {
    switch self {
    case .me:
      return "/me"
    case let .photo(id):
      return "/photos/(id)"
    case let .collection(id):
      return "/collections/(id)"
    case let .likePhoto(id):
      return "/photos/(id)/like"

  var method: HTTPMethod {
    switch self {
      case .me, .photo, .collection:
        return .get
      case .likePhoto:
        return .post

  // Sends paramters in URL or in HTTP Body
  var task: Task {
    var params = [:]
    return .requestWithParameters(params)

  var headers: [String: String] {
    return ["Authorization": "Bearer xxx"]

⚙️ Making and handling a request

import TinyNetworking

let tinyNetworking = TinyNetworking<Unsplash>()

tinyNetworking.request(.photo("1234")) { response in
  switch response {
    case let .success(result):
      let photo = try? Photo.self)
    case let .error(error):

🔥 Reactive Extensions

Reactive extensions are cool. TinyNetworking provides reactive extensions for RxSwift and soon for ReactiveSwift.


return tinyNetworking.rx
     .request(resource: .photo(id: id))
     .map(to: Photo.self)

✨ Example

See Papr

🐨 Author

This tiny library is created with ❤️ by Joan Disho at QuickBird Studios

📃 License

TinyNetworking is released under an MIT license. See for more information.

Latest podspec

    "name": "TinyNetworking",
    "version": "2.1.0",
    "license": {
        "type": "MIT"
    "homepage": "",
    "authors": {
        "Joan Disho": "[email protected]"
    "summary": "Simple network layer written in Swift.",
    "source": {
        "git": "",
        "tag": "2.1.0"
    "platforms": {
        "ios": "8.0",
        "osx": "10.10",
        "watchos": "2.0",
        "tvos": "9.0"
    "default_subspecs": "Core",
    "subspecs": [
            "name": "Core",
            "source_files": "Sources/TinyNetworking/*.swift",
            "frameworks": "Foundation"
            "name": "RxSwift",
            "source_files": "Sources/RxTinyNetworking/*.swift",
            "dependencies": {
                "TinyNetworking/Core": [],
                "RxSwift": [
                    "~> 4.0"

Pin It on Pinterest

Share This