My goal is to set off an animation when my second viewController is loaded. How do call the function once the view is loaded?
Here is the code:
UIView.animate(withDuration: 1.5, animations: {self.greyScreen.frame.origin.y = -0.39*self.screenHeight}, completion: nil)
Any advice much appreciated!
viewDidAppear() is the method of UIViewContoller Life Cycle which is called once the screen is completely visible i.e. loaded all views into the memory hierarchy. So put your this block of animation into this method. You'll get your animation effect