Skip to content

Instantly share code, notes, and snippets.

@buddies2705
Created January 28, 2019 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buddies2705/5792b7b4c6d68743be5f30c4d3569ff8 to your computer and use it in GitHub Desktop.
Save buddies2705/5792b7b4c6d68743be5f30c4d3569ff8 to your computer and use it in GitHub Desktop.
ViewController
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.getKoinData()
}
func getKoinData(){
ServiceManager.getRequestWithFullUrl("BASE_URL", success: {
(responseObject) in
print(responseObject)
let inrList = responseObject["stats"]["inr"].map {
return $1
}
let bitcoinList = responseObject["stats"]["bitcoin"].map {
return $1
}
let rippleList = responseObject["stats"]["ripple"].map {
return $1
}
let etherList = responseObject["stats"]["ether"].map {
return $1
}
let inrModelList = inrList.map {
KoinModel(jsonObject : $0)
}
let bitcoinModelList = bitcoinList.map {
KoinModel(jsonObject : $0)
}
let rippleModelList = rippleList.map {
KoinModel(jsonObject : $0)
}
let etherModelList = etherList.map {
KoinModel(jsonObject : $0)
}
let koinModelObject = finalKoinModel()
koinModelObject.inrList = inrModelList
koinModelObject.bitcoinList = bitcoinModelList
koinModelObject.rippleList = rippleModelList
koinModelObject.etherList = etherModelList
appDelegateObj().finalModelObject = koinModelObject
appDelegateObj().mainRootView()
})
{
(errorObject) in
print(errorObject)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment