Last active
March 8, 2018 19:04
-
-
Save joanmolinas/d1a2919fe07d7d5a67d342f1c30bd2c7 to your computer and use it in GitHub Desktop.
Blog.firstSolidPrinciples
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 UserInformationHandler { | |
// MARK: - Public api | |
func retrieve() { | |
let data = request() | |
let user = parse(data: data) | |
store(user: user) | |
} | |
} | |
private extension UserInformationHandler { | |
func request() -> Data { | |
// Interaction with the api | |
// Synchronous call for simplicity | |
} | |
func parse(data: Data) -> [String: Any] { | |
// parse data an create a dictionary | |
} | |
func store(user: [String: Any]) { | |
// Store on your local database, the information of the user | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment