Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- }
- }
Add Comment
Please, Sign In to add comment