import SwiftUI
import SFSafeSymbols

struct LeftImageLabel<Content>: View where Content: View {

    let systemSymbol: SFSymbol
    
    let content: Content

    init(systemSymbol: SFSymbol, @ViewBuilder content: () -> Content) {
        self.systemSymbol = systemSymbol
        self.content = content()
    }

    var body: some View {
        HStack(alignment: .center, spacing: 0) {
            content
            Image(systemSymbol: systemSymbol)
                .frame(width: 20)
        }
    }
}

struct LeftImageLabel_Previews: PreviewProvider {
    static var previews: some View {
        LeftImageLabel(systemSymbol: .house) { Text("Home address") }
    }
}
