How do I perform a task after the completion of a previous task SWIFT?

How to perform a task after the completion of a previous task SWIFT

I am fairly new to programming and I have two buttons, one is camera the other is chooseExistingPhoto. I can access the camera functionality with the camera button and am trying to diplay the image that I take onto a UIImage in another view controller. My code is giving me an error of unable to render snapshot before it is taken. I assume that this is because I am also trying to use the button as a segue to display the new view controller. Is there a way to delay the segue action until after the user picks and image through their photo library or takes a photo?
Re: How to perform a task after the completion of a previous task SWIFT

I personally do not know, but hopefully someone who does will reply soon.
Re: How to perform a task after the completion of a previous task SWIFT

@maxsmarties can help you. He says he's a developer.

Original thread: https://forums.imore.com/threads/how-do-i-perform-a-task-after-the-completion-of-a-previous-task-swift.360135/