Cria 1.1.0

Cria 1.1.0

Maintained by Meniny.



 
Depends on:
Oath>= 0
Alamofire~> 4.7
 

Cria 1.1.0

Meet Cria

Cria

Author EMail MIT
Version Platforms Swift
Build Passing Cocoapods Carthage SPM

🏵 Introduction

Cria is an elegant HTTP requests framework for Swift with ❤️ and Alamofire + Promise ☁️.

Note
Cria means a juvenile alpaca, also commonly known as 草泥马 in Mandarin Chinese.

📋 Requirements

Type Requirement

Platform

iOS

8.0

macOS

10.10

tvOS

9.0

watchOS

N/A

Linux

N/A

IDE

Xcode

10.2

Language

Swift

5

📲 Installation

CocoaPods

Cria is available on CocoaPods.

use_frameworks!
pod 'Cria'

Manually

Copy all files in the Cria directory into your project.

🛌 Dependency

❤️ Contribution

You are welcome to fork and submit pull requests.

🔖 License

Cria is open-sourced software, licensed under the MIT license.

🔫 Usage

import Cria
import Oath

let 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:

import Cria
import Oath

let 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)
    }
}