Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Meniny/Mint

🌿 Human readable HTTP request in Swift.
https://github.com/Meniny/Mint

html http ios macos multipartform-data networking request tvos urlsession watchos

Last synced: 2 months ago
JSON representation

🌿 Human readable HTTP request in Swift.

Awesome Lists containing this project

README

        

:name: Mint
:author: Elias Abel
:author_esc: Elias%20Abel
:mail: [email protected]
:desc: a human readable HTTP request library in Swift
:icon: {name}.png
:version: 2.0.0
:na: N/A
:ios: 9.0
:macos: 10.11
:watchos: 2.0
:tvos: 9.0
:linux: {na}
:xcode: 9.3
:swift: 4.1
:license: MIT
:sep: %20%7C%20
:platform: iOS{sep}macOS{sep}watchOS{sep}tvOS
// :toc: right
:source-highlighter: highlightjs
= Meet `{name}`
{author} <{mail}>
v{version}, 2018-05-19

[subs="attributes"]
++++


{name}



Author
EMail
MIT


Version
Platforms
Swift


Build Passing
Cocoapods
Carthage
SPM


++++

== 🏵 Introduction

**{name}** is {desc}.

== 📋 Requirements

[%header]
|===
2+^m|Type 1+^m|Requirement

1.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

{na}

== ❤️ 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}

let mint = Mint.init(baseURL: "https://meniny.cn/api/v2/")

mint.request("portfolio_repos.json", method: .get, parameter: .none, completion: { (data, resp) in
print(String.init(data: data, encoding: .utf8) ?? "nil", resp.statusCode)
}, failure: { error, resp in
print(error.localizedDescription, resp.statusCode)
})
----

[source, swift, subs="verbatim,attributes"]
----
import {name}

let mint = Mint.init(baseURL: "https://meniny.cn/api/v2/")

mint.get("blogroll.json") { (result: Mint.JSONResult) in
switch result {
case .success(let json, _):
print(json.dictionary)
case .failure(let error, let response):
print(error.localizedDescription, response.statusCode)
}
}
----

[source, swift, subs="verbatim,attributes"]
----
import {name}

let downloader = Mint.init(baseURL: "https://meniny.cn/assets/images/")

downloader.downloadImage("fire.jpg") { (result) in
switch result {
case .success(let image, _):
print(image)
case .failure(let error, let response):
print(error, response.statusCode)
}
}
----