项目作者: BiAtoms

项目描述 :
A tiny HTTP client written in swift. URLSession alternative
高级语言: Swift
项目地址: git://github.com/BiAtoms/Request.swift.git
创建时间: 2017-07-11T14:05:50Z
项目社区:https://github.com/BiAtoms/Request.swift

开源协议:MIT License

下载


Platform Linux
Platform
Cocoapods Compatible
Carthage Compatible
License
Build Status - Master

Request.swift

A tiny (sync/async) HTTP client written in swift.

OS

Works in linux, iOS, macOS and tvOS

Example

  1. client.request("http://example.com", headers: ["Accept": "text/html"]).response { response, error in
  2. if let response = response {
  3. print(response.statusCode)
  4. print(String(cString: response.body))
  5. } else {
  6. print(error)
  7. }
  8. }

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

  1. $ gem install cocoapods

To integrate Request.swift into your Xcode project using CocoaPods, specify it in your Podfile:

  1. source 'https://github.com/CocoaPods/Specs.git'
  2. target '<Your Target Name>' do
  3. pod 'Request.swift', '~> 2.3.0'
  4. end

Then, run the following command:

  1. $ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

  1. $ brew update
  2. $ brew install carthage

To integrate Request.swift into your Xcode project using Carthage, specify it in your Cartfile:

  1. github "BiAtoms/Request.swift" ~> 2.3.0

Run carthage update to build the framework and drag the built RequestSwift.framework into your Xcode project.

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but Request.swift does support its use on supported platforms.

Once you have your Swift package set up, adding Request.swift as a dependency is as easy as adding it to the dependencies value of your Package.swift.

  1. dependencies: [
  2. .package(url: "https://github.com/BiAtoms/Request.swift.git", from: "2.3.0")
  3. ]

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details