Swift HTTP just enough
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Source
demo.xcodeproj
demo
.gitignore
.swift-version
.travis.yml
Enough.podspec
LICENSE
README.md
enough.png

README.md


Thus, programs must be written for people to read, and only incidentally for machines to execute.
Harold Abelson, "Structure and Interpretation of Computer Programs" ( S.I.C.P )

Enough is a Swift HTTP / HTTPS networking library for people. Inspired by Pitaya.


中文简介

Example

Simple

Enough.requestForJSON(method: .get, url: "https://httpbin.org/get?hello=Hello%20Enough!") { (json, error) in
            if let _ = error { // failure
                
            } else { // success
                guard let _ = json else { return }
            }
        }

Features

  • Support setting HTTP raw body
  • Internal fully JSON support with SwiftyJSON
  • Support setting custom HTTP headers

Requirements

  • iOS 9.0+
  • Xcode 9 (Swift 3) (0.0.5) in master branch.

Installation

CocoaPods

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

$ gem install cocoapods

CocoaPods 1.1+ is required to build Enough.

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

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'Enough', '~> 0.0.5'
end

Then, run the following command:

$ pod install

Source File

Clone all files in the Source directory into your project.

Contribution

You are welcome to fork and submit pull requests.

License

Pitaya is open-sourced software licensed under the MIT license.

中文介绍

使用示例

基本用法

Enough.requestForJSON(method: .get, url: "https://httpbin.org/get?hello=Hello%20Enough!") { (json, error) in
            if let _ = error { // failure
                
            } else { // success
                guard let _ = json else { return }
            }
        }

功能

  • 支持设置 HTTP raw body
  • 内置 (支持 SwiftyJSON),完全支持 JSON 数据
  • 支持设定 HTTP headers

环境要求

  • iOS 9.0+
  • Xcode 9 (Swift 3) 0.0.5 版,位于 master 分支

安装

CocoaPods

CocoaPods 是一个包管理工具. 您可以通过以下命令安装:

$ gem install cocoapods

安装Enough需要CocoaPods 1.1+版本.

在您的Podfile文件中使用Enough Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'Enough', '~> 0.0.5'
end

然后运行 pod install.

源代码安装

Source 文件夹下的文件拖进你的文件树里即可。

参与开源

欢迎提交 issue 和 PR,大门永远向所有人敞开。

开源协议

本项目遵循 MIT 协议开源,具体请查看根目录下的 LICENSE 文件。