How do you get the frame size in UIViewRepresentable?
I have a simple DrawView class that draw something and I would like to integrate with SwiftUI. This code works if I hardcode the frame size to 640x480, but is it possible to know the current frame size of ContentView?
struct ContentView: View { var body: some View { SwiftDrawView() } } struct SwiftDrawView: UIViewRepresentable { func makeUIView(context: Context) -> DrawView { DrawView(frame:CGRect(x: 0, y: 0, width: 640, height: 480)) } .... } The Apple tutorial always use .zero and it won't work in this case.

.zeroframe frommakeUIView, and try triggering the drawing in theupdateUIViewmethod ofUIViewRepresentable