Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/meniny/cria
An elegant HTTP requests framework for Swift with ❤️ and Alamofire + Promise. ☁️
https://github.com/meniny/cria
alamofire http https ios macos promise tvos
Last synced: about 1 month ago
JSON representation
An elegant HTTP requests framework for Swift with ❤️ and Alamofire + Promise. ☁️
- Host: GitHub
- URL: https://github.com/meniny/cria
- Owner: Meniny
- License: mit
- Created: 2018-05-22T05:10:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-21T10:53:53.000Z (over 5 years ago)
- Last Synced: 2024-11-18T03:39:01.409Z (about 1 month ago)
- Topics: alamofire, http, https, ios, macos, promise, tvos
- Language: Swift
- Homepage:
- Size: 842 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE.md
Awesome Lists containing this project
README
:name: Cria
:author: Elias Abel
:author_esc: Elias%20Abel
:mail: [email protected]
:desc: an elegant HTTP requests framework for Swift with ❤️ and Alamofire + Promise ☁️
:icon: {name}.png
:version: 1.1.0
:na: N/A
:ios: 8.0
:macos: 10.10
:watchos: {na}
:tvos: 9.0
:linux: {na}
:xcode: 10.2
:swift: 5
:license: MIT
:sep: %20%7C%20
:platform: iOS{sep}macOS{sep}tvOS
// :toc: left
:toclevels: 6
:toc-title: TOC
:source-highlighter: highlightjs
// :source-highlighter: pygments
= Meet `{name}`
{author} <{mail}>
v{version}, 2019-04-21[subs="attributes"]
++++
++++:toc:
== 🏵 Introduction
**{name}** is {desc}.
NOTE: `Cria` means a juvenile alpaca, also commonly known as `草泥马` in Mandarin Chinese.
== 📋 Requirements
[%header]
|===
2+^m|Type 1+^m|Requirement1.5+^.^|Platform ^|iOS ^|{ios}
^|macOS ^|{macos}
^|tvOS ^|{tvos}
^|watchOS ^|{watchos}
^|Linux ^|{linux}^|IDE ^|Xcode ^| {xcode}
^|Language ^|Swift ^| {swift}
|===== 📲 Installation
=== CocoaPods
`{name}` is available on link:https://cocoapods.org[CocoaPods].
[source, ruby, subs="verbatim,attributes"]
----
use_frameworks!
pod '{name}'
----=== Manually
Copy all files in the `{name}` directory into your project.
== 🛌 Dependency
* link:https://github.com/Meniny/Oath[Oath]
* link:https://github.com/Alamofire/Alamofire[Alamofire]== ❤️ Contribution
You are welcome to fork and submit pull requests.
== 🔖 License
`{name}` is open-sourced software, licensed under the link:./LICENSE.md[`{license}`] license.
== 🔫 Usage
[source, swift, subs="verbatim,attributes"]
----
import {name}
import Oathlet cria = Cria.init("https://meniny.cn/api/v2/")
// A simple get request:
cria.get("posts.json").then { response in
print("Done: ", response.code)
}.onError { error in
print("Error: ", error.localizedDescription)
}// or:
cria.do(.get, path: "posts.json").then { response in
print("Done: ", response.code)
}.onError { error in
print("Error: ", error.localizedDescription)
}
----For `multipart-form`:
[source, swift, subs="verbatim,attributes"]
----
import {name}
import Oathlet cria = Cria.init("https://some-domain.com/")
let image = #imageLiteral(resourceName: "Cria")
if let data = UIImageJPEGRepresentation(image, 1) {
let part = CriaFormPart.init(.data(data), name: "image", mimetype: "image/jpeg")
cria.postMultipart("some_uploading_api/subpath/", data: [part]).progress { p in
print("Progress: ", p)
}.then { response in
print("Done: ", response.code)
}.onError { error in
print("Error: ", error.localizedDescription)
}
}
----