Created
July 12, 2017 09:19
-
-
Save tranhieutt/7d9730f387e7ea9483200f61977dfeae to your computer and use it in GitHub Desktop.
SOLID - S
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
class Handler { | |
func handle() { | |
let data = requestDataToAPI() | |
let array = parse(data: data) | |
saveToDB(array:array) | |
} | |
private func requestDataToAPI() -> Data { | |
//send API request and wait the response | |
} | |
private func parse(data: Data) -> [String] { | |
//parse data and create the array | |
} | |
private func saveToDB(array: [String]) { | |
//save the array in a database (CoreData, Realm) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment