Mint
认识
🏵 简介
Mint 是一个用 Swift 编写的易于阅读的 HTTP 请求库。
📋 要求
类型 | 需求 | |
---|---|---|
平台 |
iOS |
9.0+ |
macOS |
10.11 |
|
tvOS |
9.0 |
|
watchOS |
2.0 |
|
Linux |
未提供 |
|
IDE |
Xcode |
9.3+ |
语言 |
Swift |
4.1+ |
📲 安装
手动
将 Mint
目录下的所有文件复制到您的项目中。
🛌 依赖关系
未提供
❤️ 贡献
欢迎您克隆并提交拉取请求。
🔖 许可证
Mint
是开源软件,受 MIT
许可证的许可。
🔫 使用方法
import Mint
let mint = Mint.init(baseURL: "https://meniny.cn/api/v2/")
self.mint.get("posts.json") { (result) in
switch result {
case .success(let response):
print(response.dictionaryBody)
case .failure(let response):
print(response.error.localizedDescription)
}
}
import Mint
let downloader = Mint.init(baseURL: "https://meniny.cn/assets/images/")
self.downloader.downloadImage("fire.jpg") { (result) in
print("Done.")
switch result {
case .success(let resp):
print(resp.image)
case .failure(let resp):
print(resp.error.localizedDescription)
}
}