Maxatma / ReactiveAlamofire

Example of reactive DataRequest for Alamofire 4.2 based on ReactiveKit 3.1.1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example of DataRequest for ReactiveKit

Using Alamofire (4.2.0),

Bond (5.1.2),

ReactiveKit (3.1.1)

Actual issue

Usage example:

    let apiString           = "https://pixabay.com/api/"
    
    let apiKey              = "2558715-0fea309eb5cf824cd64a2e01f"
    
    let defaultSearchString = "red roses"
    
    let parameters = [ "key" : apiKey,
                       "q" : defaultSearchString]
    
    
    Alamofire.request(apiString,
                      method: .get,
                      parameters: parameters)
        .toSignal()
        .observeNext(with: { (response, request, data) in
            do {
                let json = try JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.allowFragments)
                print(json)
            } catch {
                print(error)
            }
        })
        .disposeIn(bnd_bag)
}

Contact

Aleksandr Zaporozhchenko [github] [gmail] [fb] [in]

About

Example of reactive DataRequest for Alamofire 4.2 based on ReactiveKit 3.1.1

License:MIT License


Languages

Language:Swift 91.3%Language:Ruby 8.7%