view LazyBear/Views/Profile/Networking/Profile.swift @ 401:f843c6382529

Add Enumeration to Networks files
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Thu, 20 May 2021 21:04:49 +0200
parents 4c90e5b18632
children 444ec927d62f
line wrap: on
line source

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

import SwiftUI

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