Skip to content

Example of reactive DataRequest for Alamofire 4.2 based on ReactiveKit 3.1.1

License

Notifications You must be signed in to change notification settings

Maxatma/ReactiveAlamofire

Repository files navigation

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published