Skip to content
An elegant HTTP requests framework for Swift with ❤️ and Alamofire + Promise. ☁️
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Assets
Cria/Core
Sample
.gitignore
Cartfile
Cria.podspec
LICENSE.md
Package.swift
README.adoc
_config.yml

README.adoc

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)
    }
}
You can’t perform that action at this time.