garynewby/PianoKeyboard

How to use in modern ContentView

abulka opened this issue · 1 comments

Sorry for the newbie question, but is it possible to use this component in a swiftui contentview e.g. something like

import SwiftUI
import PianoKeyboard

struct ContentView: View {
    var body: some View {
        VStack {
            PianoKeyboard()
            Text("Hello, world!")
                .padding()
        }
    }
}

In the above I get the error Static method 'buildBlock' requires that 'PianoKeyboard' conform to 'View'?

On iOS (or Mac Catalyst) you can use UIViewRepresentable to wrap the PianoKeyboard, as it a UIKit View, for use in SwiftUI.