Latest 1.1.0
Homepage https://github.com/MihaelIsaev/ReactiveCodyFire
License MIT
Platforms ios 8.0
Dependencies CodyFire, ReactiveCocoa
Authors

Version
License
Platform

Installation

via CocoaPods

pod 'ReactiveCodyFire'

How to use

Please see API declaration examples in the original CodyFire repo https://github.com/MihaelIsaev/CodyFire

Let’s imagine that you have ToDos app. Our goal is to get a list of ToDos.

Ok, let’s declare a ToDo model in Models/ToDoModel.swift

struct ToDoModel: Codable {
    let id: UUID
    let text: String
    let createdAt: Date
}

Then declare your API class in /API/API.swift file

class API {
    typealias todo = ToDoController
}

Then declare your empty ToDo controller in API/Controllers/ToDoController.swift file

class ToDoController {}

And in a separated decorator API/Controllers/ToDo+Search.swift file declare a search endpoint

import ReactiveCodyFire

extension ToDoController {
    struct Query: Codable {
        let text: String
    }
    static func search(_ text: String) -> APIRequest<[ToDo]> {
        return APIRequest("todo").query(Query(text: text))
    }
}

When everything is ready you’re able to easily use it in your reactive code!
Please don’t forget to import ReactiveCodyFire
Every APIRequest contains signalProducer, so just call it whenever you need API call and just use it!

API.todos.search("").signalProducer

Nice, right?

TIP: There is no need to also import CodyFire cause it's already imported by ReactiveCodyFire

Author

Mihael Isaev, [email protected]

License

ReactiveCodyFire is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "ReactiveCodyFire",
    "version": "1.1.0",
    "summary": "CodyFire wrapper for ReactiveCocoa ud83dudd25",
    "description": "Install this pod to use CodyFire with ReactiveCocoa ud83dudd25",
    "homepage": "https://github.com/MihaelIsaev/ReactiveCodyFire",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "MihaelIsaev": "[email protected]"
    },
    "source": {
        "git": "https://github.com/MihaelIsaev/ReactiveCodyFire.git",
        "tag": "1.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ReactiveCodyFire/Classes/**/*",
    "dependencies": {
        "CodyFire": [],
        "ReactiveCocoa": [
            "~> 8.0.2"
        ]
    },
    "swift_version": "4.1.2"
}

Pin It on Pinterest

Share This