Swiftpack.co - Package - aliyun/AlamofirePromiseKit

AlamofirePromiseKit

Cocoapod Version

Implement ‘Alamofire’ synchronous callback

Requirements

  • Alamofire ~> 4.9.1
  • AwaitKit ~> 5.2.0

Installation

Swift Package Manager

You can use The Swift Package Manager to install AlamofirePromiseKit by adding the proper description to your Package.swift file:

import PackageDescription

let package = Package(
    name: "YOUR_PROJECT_NAME",
    dependencies: [
        .Package(url: "https://github.com/aliyun/AlamofirePromiseKit.git")
    ]
)

Note that the Swift Package Manager is still in early design and development, for more information checkout its GitHub Page.

Usage example

import Foundation
import Alamofire
import AwaitKit

let sessionManager:SessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.default)
let promise = sessionManager.request("https://httpbin.org/get", method: HTTPMethod.get).response()
let res: DefaultDataResponse = try! await(promise)
let result: String = String(data: res.data!, encoding: .utf8) ?? ""

print(result)

Github

link
Stars: 1

Used By

Total: 0

Releases

v1.0.0 - 2020-02-01 03:10:31