view LazyBear/Views/Profile/Networking/Profile.swift @ 425:4effac4733b0

Changing keys from API responses
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Wed, 16 Jun 2021 13:46:01 +0200
parents 444ec927d62f
children 4b8031e696e8
line wrap: on
line source

//
//  Profile.swift
//  LazyBear
//
//  Created by Dennis Concepción Martín on 7/5/21.
//

import SwiftUI
import Bazooka

class Profile: ObservableObject {
    @Published var showView = false
    @Published var data = ProfileResponse()
    
    func request(_ url: String, _ requestType: RequestType) {
        let bazooka = Bazooka()
        bazooka.request(url: url, model: ProfileResponse.self) { response in
            switch requestType {
            case .initial:
                self.data = response
            default:
                self.data = response
            }
            
            self.showView = true
        }
    }
}