Created
March 22, 2019 19:04
-
-
Save bill350/b714e07a77389d13c44a24b285c39e36 to your computer and use it in GitHub Desktop.
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
func downloadLastLokaliseStrings() { | |
let lokaliseTask = urlSession.dataTask(with: lokaliseRequest) { (data, response, error) in | |
if let error = error { | |
// manage error | |
} else { | |
guard let data = data else { | |
// be sure to have data | |
return | |
} | |
do { | |
// Parse the first response | |
let lokaliseResponse = try JSONDecoder().decode(LokaliseFileDownloadResponse.self, from: data) | |
let url = URL(string: lokaliseResponse.bundle_url)! | |
// Archive downloading | |
let downloadDataTask = urlSession.dataTask(with: url, completionHandler: { (data, response, error) in | |
// Dezipping stuff | |
}) | |
downloadDataTask.resume() | |
} catch { | |
// Error catching | |
} | |
} | |
} | |
lokaliseTask.resume() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment