Latest 1.0.7
License MIT
Platforms ios 9.3, requires ARC

GitHub release
Build Status
GitHub repo size

BaseNetworkKit is the easiest way to create your network layer in Swift.
Inspired by Moya


  • iOS 9.3+
  • Swift 4.1+



BaseNetworkKit is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'BaseNetworkKit', '~> 1.0'

and run pod install


Just copy source folder to your project.

Framework > BaseNetworkKit > Source

How to use

Import library in your network layer:

import BaseNetworkKit

Example using Twitch API:

Setup request

enum RequesterAPI {
  case topGames(ModelRequest)

extension RequesterAPI: NKFlowTarget {
  var baseURL: URL {
    return URL(stringValue: "")

  var path: String {
    switch self {
    case .topGames:
      return "kraken/games/top"

  var method: NKHTTPMethods {
    return .get

  var headers: NKCommon.HTTPHeader? {
    return [
      "Accept": "application/vnd.twitchtv.v5+json",
      "Client-ID": "5f1mxwqmosk9lsmwoglmz7o6icahcq"

  var task: NKTask {
    switch self {
    case .topGames(let body):
      guard let params = body.dictionary(), !params.isEmpty else {
        return .requestPlain
      return .requestParameters(params, encoding: .queryString)

  var environment: NKEnvironment {
    return .develop

Than, create a request function

class DashService: NKBaseService<DashAPI> {
  func fetchGames(page: Int, limit: Int, completion: @escaping NKCommon.ResultType<Model>) {
    let requestModel = ModelRequest(offset: "(page)", limit: "(limit)")
    fetch(.topGames(requestModel), dataType: Model.self, completion: completion)

If you need more examples, open demo project.


  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request. 👨🏻‍💻


BaseNetworkKit is under MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "BaseNetworkKit",
    "version": "1.0.7",
    "summary": "BaseNetworkKit is the easiest way to create your network layer in Swift",
    "requires_arc": true,
    "homepage": "",
    "license": "MIT",
    "authors": {
        "John Lima": "[email protected]"
    "social_media_url": "",
    "platforms": {
        "ios": "9.3"
    "source": {
        "git": "",
        "tag": "1.0.7"
    "source_files": "Framework/BaseNetworkKit/Source/**/*.{swift}",
    "swift_versions": "4.1",
    "swift_version": "4.1"

Pin It on Pinterest

Share This