You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have stored the JSON string of the drawing and want to reload it back into DrawingView.
func loadScratchText() {
let jsonDecoder = JSONDecoder()
let scratchText = self.viewModel.scratchText
print("scratchText: \(scratchText)")
guard let jsonData = scratchText.data(using: .utf8) else {
return
}
guard let drawing = try? jsonDecoder.decode(Drawing.self, from: jsonData) else {
print("Unable to load scratch json")
return
}
self.drawingView.drawing = drawing
print(drawingView.drawing.shapes)
print("")
}
If I call this function in viewWillAppear - it prints the shapes but the drawing is NOT visible. But when I use viewDidAppear - it does nicely render back the drawing.
Is this expected behavior?
thanks
Ram
The text was updated successfully, but these errors were encountered:
I have stored the JSON string of the drawing and want to reload it back into DrawingView.
If I call this function in viewWillAppear - it prints the shapes but the drawing is NOT visible. But when I use viewDidAppear - it does nicely render back the drawing.
Is this expected behavior?
thanks
Ram
The text was updated successfully, but these errors were encountered: