Latest 0.2.0
Homepage https://github.com/devxoul/Endpoint
License MIT
Platforms ios 8.0, osx 10.9, requires ARC
Dependencies Alamofire
Authors

Swift
Build Status
CocoaPods
Carthage compatible

🚀 Elegant API Abstraction for Swift.

At a Glance

API Declarations

Create an Enum with raw type Rule and conform protocol Endpoint. Each cases is the API endpoint which contains HTTP method and URL path.

enum GitHub: Rule, Endpoint {
    static var baseURLString = "https://api.github.com"

    case Repo        = "GET  /repos/<owner>/<repo>"
    case RepoIssues  = "GET  /repos/<owner>/<repo>/issues"
    case CreateIssue = "POST /repos/<owner>/<repo>/issues"
}
Using APIs

Endpoint is built on Alamofire. Calling request() on endpoint cases returns Alamofire.Request instance.

GitHub.Repo.request(["owner": "devxoul", "repo": "Then"]).responseJSON { response in
    // This is an Alamofire's response block!
}

This example is sending an HTTP request to https://api.github.com/repos/devxoul/Then using GET.

Installation

  • Using CocoaPods:

    pod 'Endpoint', '~> 0.2'
  • Using Carthage:

    github "devxoul/Endpoint" ~> 0.2
  • Using Swift Package Manager:

    import PackageDescription
    
    let package = Package(
        name: "MyAwesomeApp",
        dependencies: [
            .Package(url: "https://github.com/devxoul/Endpoint", "0.2.0"),
        ]
    )

License

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

Latest podspec

{
    "name": "Endpoint",
    "version": "0.2.0",
    "summary": "Elegant API Abstraction for Swift.",
    "homepage": "https://github.com/devxoul/Endpoint",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Suyeol Jeon": "[email protected]"
    },
    "source": {
        "git": "https://github.com/devxoul/Endpoint.git",
        "tag": "0.2.0"
    },
    "source_files": "Sources/*.swift",
    "requires_arc": true,
    "dependencies": {
        "Alamofire": [
            "~> 3.2"
        ]
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.9"
    }
}

Pin It on Pinterest

Share This