0

I want to set the Zoom scale of my PKCanvasView()

I tried adding this function:

func setCanvasZoom() {
    canvasView.zoomScale = 2.0
    print("CanvasView: \(canvasView.zoomScale)")
}

But that function always throws 1.0 in the console...

I am calling the setCanvasView() function, after my ScrollView appeared:

ZStack {
    ScrollView {
        VStack {
            CanvasView(canvasView: $canvasView)
        }
    }.onAppear(perform: {
        setCanvasZoom()
    })
}

The canvasView variable is declared like that:

@State var canvasView = PKCanvasView()

Do you guys have any Idea why this happens?

ThePyzhov
  • 259
  • 2
  • 14
yama_HD
  • 480
  • 1
  • 4
  • 14

0 Answers0