Created
May 15, 2017 18:05
-
-
Save pffan91/11d4be4b0c665b339136a1a4b8a71751 to your computer and use it in GitHub Desktop.
NetworkLayerWithMoya_parsingDataFromServer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by Vladyslav Semenchenko on 15/05/2017. | |
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved. | |
NetworkAdapter.request(target: .cameras, success: { (response) in | |
// parse your data | |
do { | |
let cameras: [Camera] = try response.mapArray() as [Camera] | |
// do something with cameras | |
} catch { | |
// can't parse data, show error | |
} | |
}, error: { (error) in | |
// show error from server | |
}, failure: { (error) in | |
// show Moya error | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment