🏇 A Swift HTTP / HTTPS networking library just incidentally execute on machines
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 )
Pitaya is a Swift HTTP / HTTPS networking library for people. Inspired by Alamofire and JustHTTP.
Pita.build(HTTPMethod: .GET, url: "https://httpbin.org/get?hello=Hello%20Pitaya!")
.responseJSON { (json, response) -> Void in
print(json["args"]["hello"].stringValue) // get "Hello Pitaya!"
}
You can use The Swift Package Manager to install Pitaya
by adding the proper description to your Package.swift
file:
import PackageDescription
let package = Package(
name: "YOUR_PROJECT_NAME",
targets: [],
dependencies: [
.Package(url: "https://github.com/johnlui/Pitaya.git", versions: "1.3.4" ..< Version.max)
]
)
Note that the Swift Package Manager is still in early design and development, for more infomation checkout it’s GitHub Page
Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate Pitaya into your Xcode project using Carthage, specify it in your Cartfile:
github "JohnLui/Pitaya"
Then fetch and build Pitaya:
carthage update
At last, add it to “Embedded Binaries” in the general panel use the “Add Other…” button. The Pitaya.framework binary file is lying in ./Carthage/Build/iOS
directory.
git submodule add https://github.com/johnlui/Pitaya.git
open .
then drag Pitaya.xcodeproj into your Project, that’s it!
If you want to run your project on devices with Pitaya, just go to PROJECT->TARGETS->[your project name]->General->Embedded Binaries, click +, select Pitaya.frameWork and click “Add”.
Clone all files in the Source
directory into your project.
You are welcome to fork and submit pull requests.
Pitaya is open-sourced software licensed under the MIT license.
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 )
Pitaya(火龙果) 是一个写给人看的纯 Swift 写成的 HTTP / HTTPS 网络库。从 Alamofire 和 JustHTTP 偷了一些创意和代码。
Pita.build(HTTPMethod: .GET, url: "https://httpbin.org/get?hello=Hello%20Pitaya!")
.responseJSON { (json, response) -> Void in
print(json["args"]["hello"].stringValue) // get "Hello Pitaya!"
}
The Swift Package Manager 是苹果伴随 Swift 开源而推出的 Swift 语言包管理工具。
编辑你项目的 Package.swift
:
import PackageDescription
let package = Package(
name: "YOUR_PROJECT_NAME",
targets: [],
dependencies: [
.Package(url: "https://github.com/johnlui/Pitaya.git", versions: "1.3.4" ..< Version.max)
]
)
Swift Package Manager 依然在开发中,功能不太稳定,建议关注它的 GitHub Page。
Carthage 是一个去中心化的 Cocoa 应用程序自动依赖添加工具。
使用以下命令安装 Carthage
$ brew update
$ brew install carthage
安装好 Carthage 后,将下列内容加入你项目的 Cartfile:
github "JohnLui/Pitaya"
自动下载、编译 Pitaya:
carthage update
最后,在 general panel 里 的 “Embedded Binaries” 项下点击 “Add Other…” 按钮,Pitaya.framework 已经躺在了 ./Carthage/Build/iOS
目录里。
这种方法目前还不支持 BITCODE,如果需要支持,请直接将 Pitaya.xcodeproj 拖入你的工程。
git clone https://github.com/johnlui/Pitaya.git
open Pitaya
在打开的 Finder 窗口中把 Pitaya.xcodeproj 拖到 Xcode 你的文件树里。
真机调试还需要额外的一步:打开 PROJECT->TARGETS->[your project name]->General,找到 Embedded Binaries, 点击 +, 选中 Pitaya.framework,点击“Add”即可。
把 Source
文件夹下的文件拖进你的文件树里即可。
欢迎提交 issue 和 PR,大门永远向所有人敞开。
本项目遵循 MIT 协议开源,具体请查看根目录下的 LICENSE 文件。