{"id":19039838,"url":"https://github.com/johnlui/pitaya","last_synced_at":"2025-04-04T20:09:49.480Z","repository":{"id":32039365,"uuid":"35610823","full_name":"johnlui/Pitaya","owner":"johnlui","description":"🏇 A Swift HTTP / HTTPS networking library just incidentally execute on machines","archived":false,"fork":false,"pushed_at":"2019-11-27T03:10:45.000Z","size":4303,"stargazers_count":843,"open_issues_count":6,"forks_count":100,"subscribers_count":38,"default_branch":"swift5","last_synced_at":"2025-03-28T19:07:26.301Z","etag":null,"topics":["http","https","ios","network","ssl-pinning","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnlui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-14T12:50:57.000Z","updated_at":"2025-03-23T00:54:13.000Z","dependencies_parsed_at":"2022-08-26T06:35:37.309Z","dependency_job_id":null,"html_url":"https://github.com/johnlui/Pitaya","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlui%2FPitaya","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlui%2FPitaya/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlui%2FPitaya/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlui%2FPitaya/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnlui","download_url":"https://codeload.github.com/johnlui/Pitaya/tar.gz/refs/heads/swift5","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242678,"owners_count":20907134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","https","ios","network","ssl-pinning","swift"],"created_at":"2024-11-08T22:19:03.199Z","updated_at":"2025-04-04T20:09:49.461Z","avatar_url":"https://github.com/johnlui.png","language":"Swift","readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/johnlui/Pitaya\"\u003e\u003cimg src=\"https://github.com/johnlui/Pitaya/blob/swift3/assets/logo@2x.jpg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/johnlui/Pitaya\"\u003e\u003cimg src=\"https://img.shields.io/badge/platform-ios-lightgrey.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/johnlui/Pitaya\"\u003e\u003cimg src=\"https://img.shields.io/github/license/johnlui/Pitaya.svg?style=flat\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/johnlui/Pitaya\"\u003e\u003cimg src=\"https://img.shields.io/badge/language-Swift%203-orange.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\u003cimg src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://travis-ci.org/johnlui/Pitaya\"\u003e\u003cimg src=\"https://img.shields.io/travis/johnlui/Pitaya.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n\u003cblockquote align=\"center\"\u003e\n    \u003cspan\u003eThus, programs must be written for people to read, and only incidentally for machines to execute.\u003c/span\u003e\n    \u003cbr\u003e\n    \u003cspan\u003eHarold Abelson, \"\u003ca href=\"https://mitpress.mit.edu/sicp/front/node3.html\"\u003eStructure and Interpretation of Computer Programs\u003c/a\u003e\" ( S.I.C.P )\u003c/span\u003e\n\u003c/blockquote\u003e\n\n\u003cbr\u003e\n\nPitaya is a Swift HTTP / HTTPS networking library for people. Inspired by [Alamofire](https://github.com/Alamofire/Alamofire) and [JustHTTP](https://github.com/JustHTTP/Just).\n\n\u003cbr\u003e\n\n### [中文简介](#中文介绍)\n\n## Example\n\n### Simple\n\n```swift\nPita.build(HTTPMethod: .GET, url: \"https://httpbin.org/get?hello=Hello%20Pitaya!\")\n    .responseJSON { (json, response) -\u003e Void in\n        print(json[\"args\"][\"hello\"].stringValue) // get \"Hello Pitaya!\"\n}\n```\n\n### All examples\n\n![All Examples](https://github.com/johnlui/Pitaya/blob/swift3/assets/PitayaExample@2x.png)\n\n## Documentation\n\n### [Read the documentation](https://github.com/johnlui/Pitaya/wiki)\n### [中文文档](https://github.com/johnlui/Pitaya/wiki/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3)\n\n## Features\n\n- [x] Support Swift Package Manager\n- [x] Elegant APIs for people\n- [x] Support HTTP Basic Authorization\n- [x] Support setting SSL pinning\n- [x] Support setting HTTP raw body (include [JSON body](https://github.com/johnlui/Pitaya/wiki#http-raw-body))\n- [x] Asynchronous \u0026 Queue\n- [x] Upload files fast\n- [x] Internal fully JSON support with [JSONNeverDie](https://github.com/johnlui/JSONNeverDie)\n- [x] Support setting custom HTTP headers\n- [x] almost 100% tested\n\n## Requirements\n\n* iOS 7.0+\n* Xcode 10.2 (Swift 5) (v4.x) in the default swift5 branch.\n* Xcode 9 (Swift 4) (v3.x) in swift4 branch.\n* Xcode 8 (Swift 3) (v2.x) in swift3 branch.\n* Xcode 7 (Swift 2) (v1.x) in master branch.\n* Xcode 6.4 (Swift 1.2) before [v0.2.3](https://github.com/johnlui/Pitaya/releases/tag/v0.2.3)\n\n## Installation\n\n### Swift Package Manager\nYou can use [The Swift Package Manager](https://swift.org/package-manager) to install `Pitaya` by adding the proper description to your `Package.swift` file:\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"YOUR_PROJECT_NAME\",\n    targets: [],\n    dependencies: [\n        .Package(url: \"https://github.com/johnlui/Pitaya.git\", versions: \"1.3.4\" ..\u003c Version.max)\n    ]\n)\n```\n\nNote that the [Swift Package Manager](https://swift.org/package-manager) is still in early design and development, for more infomation checkout it's [GitHub Page](https://github.com/apple/swift-package-manager)\n\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.\n\nYou can install Carthage with Homebrew using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate Pitaya into your Xcode project using Carthage, specify it in your Cartfile:\n\n```json\ngithub \"JohnLui/Pitaya\"\n```\n\nThen fetch and build Pitaya:\n\n```bash\ncarthage update\n```\n\nAt 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.\n\n\n### Manually\n\n```bash\ngit submodule add https://github.com/johnlui/Pitaya.git\nopen .\n```\nthen drag Pitaya.xcodeproj into your Project, that's it!\n\nIf you want to run your project on devices with Pitaya, just go to PROJECT-\u003eTARGETS-\u003e[your project name]-\u003eGeneral-\u003eEmbedded Binaries, click ＋, select Pitaya.frameWork and click \"Add\".\n\n### Source File\n\nClone all files in the `Source` directory into your project.\n\n\n## Contribution\n\nYou are welcome to fork and submit pull requests.\n\n## License\n\nPitaya is open-sourced software licensed under the MIT license.\n\n# 中文介绍\n\n\u003e Thus, programs must be written for people to read, and only incidentally for machines to execute.（代码是写给人看的，只是恰好能运行。）\n\u003e \n\u003e Harold Abelson, \"[Structure and Interpretation of Computer Programs](https://mitpress.mit.edu/sicp/front/node3.html)\" ( S.I.C.P )\n\nPitaya(火龙果) 是一个写给人看的纯 Swift 写成的 HTTP / HTTPS 网络库。从 [Alamofire](https://github.com/Alamofire/Alamofire) 和 [JustHTTP](https://github.com/JustHTTP/Just) 偷了一些创意和代码。\n\n## 使用示例\n\n### 基本用法\n\n```swift\nPita.build(HTTPMethod: .GET, url: \"https://httpbin.org/get?hello=Hello%20Pitaya!\")\n    .responseJSON { (json, response) -\u003e Void in\n        print(json[\"args\"][\"hello\"].stringValue) // get \"Hello Pitaya!\"\n}\n```\n\n### 所有用法\n\n![All Examples](https://github.com/johnlui/Pitaya/blob/swift3/assets/PitayaExample@2x.png)\n\n### [中文文档](https://github.com/johnlui/Pitaya/wiki/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3)\n\n## 功能\n\n- [x] 支持 Swift Package Manager\n- [x] 写给人用的优雅 API\n- [x] 支持 HTTP Basic Authorization\n- [x] 支持设置 SSL 钢钉，防“中间人攻击”\n- [x] 支持设置 HTTP raw body (支持 [JSON body](https://github.com/johnlui/Pitaya/wiki#http-raw-body))\n- [x] 异步、队列\n- [x] 快速文件上传\n- [x] 内置 [JSONNeverDie](https://github.com/johnlui/JSONNeverDie)，完全支持 JSON 数据\n- [x] 支持设定 HTTP headers\n- [x] 几乎 100% 测试率\n\n## 环境要求\n\n* iOS 7.0+\n* Xcode 10.2 (Swift 5) v4.x 版，位于 swift5 分支（当前默认版本）\n* Xcode 9 (Swift 4) v3.x 版，位于 swift4 分支\n* Xcode 8 (Swift 3) v2.x 版，位于 swift3 分支\n* Xcode 7 (Swift 2) v1.x 版，位于 master 分支\n* Xcode 6.4 (Swift 1.2) 版： [v0.2.3](https://github.com/johnlui/Pitaya/releases/tag/v0.2.3)\n\n## 安装\n\n### Swift Package Manager\n\n[The Swift Package Manager](https://swift.org/package-manager) 是苹果伴随 Swift 开源而推出的 Swift 语言包管理工具。\n\n编辑你项目的 `Package.swift`：\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"YOUR_PROJECT_NAME\",\n    targets: [],\n    dependencies: [\n        .Package(url: \"https://github.com/johnlui/Pitaya.git\", versions: \"1.3.4\" ..\u003c Version.max)\n    ]\n)\n```\n\n[Swift Package Manager](https://swift.org/package-manager) 依然在开发中，功能不太稳定，建议关注它的 [GitHub Page](https://github.com/apple/swift-package-manager)。\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) 是一个去中心化的 Cocoa 应用程序自动依赖添加工具。\n\n使用以下命令安装 Carthage\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\n安装好 Carthage 后，将下列内容加入你项目的 Cartfile:\n\n```json\ngithub \"JohnLui/Pitaya\"\n```\n\n自动下载、编译 Pitaya:\n\n```bash\ncarthage update\n```\n\n最后，在 general panel 里 的 \"Embedded Binaries\" 项下点击 \"Add Other...\" 按钮，Pitaya.framework 已经躺在了 `./Carthage/Build/iOS` 目录里。\n\u003e 这种方法目前还不支持 BITCODE，如果需要支持，请直接将 Pitaya.xcodeproj 拖入你的工程。\n\n### 手动安装\n\n```bash\ngit clone https://github.com/johnlui/Pitaya.git\nopen Pitaya\n```\n在打开的 Finder 窗口中把 Pitaya.xcodeproj 拖到 Xcode 你的文件树里。\n\n真机调试还需要额外的一步：打开 PROJECT-\u003eTARGETS-\u003e[your project name]-\u003eGeneral，找到 Embedded Binaries, 点击 ＋, 选中 Pitaya.framework，点击“Add”即可。\n\n### 源代码安装\n\n把 `Source` 文件夹下的文件拖进你的文件树里即可。\n\n## 参与开源\n\n欢迎提交 issue 和 PR，大门永远向所有人敞开。\n\n## 开源协议\n\n本项目遵循 MIT 协议开源，具体请查看根目录下的 LICENSE 文件。\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnlui%2Fpitaya","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnlui%2Fpitaya","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnlui%2Fpitaya/lists"}