//
//  BaseView.swift
//  SodaLive
//
//  Created by klaus on 2023/08/09.
//

import SwiftUI

struct BaseView<Content: View>: View {
    
    let content: Content
    
    @Binding var isLoading: Bool
    
    init(isLoading: Binding<Bool> = .constant(false), @ViewBuilder content: () -> Content) {
        self._isLoading = isLoading
        self.content = content()
    }
    
    var body: some View {
        ZStack {
            Color.black.ignoresSafeArea()
            
            content
            
            if isLoading {
                LoadingView()
            }
        }
    }
}

struct BaseView_Previews: PreviewProvider {
    static var previews: some View {
        BaseView(isLoading: .constant(false)) {}
    }
}
