From the course: Learning iOS Animations with UIKit

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Updating the animation manager

Updating the animation manager - iOS Tutorial

From the course: Learning iOS Animations with UIKit

Start my 1-month free trial

Updating the animation manager

- [Instructor] It's always a good idea to keep as much of your animation code separated out from your view controller as possible. With that in mind, let's take a shot at updating our AnimationManager with some procedural code to handle a view controller's initial setup. Go ahead and open up the AnimationManager.swift file and underneath our screen positioning variables, let's make ourselves some room and declare a new init function. This initializer is going to take in an array of NSLayoutConstraints. We're going to call this activeConstraints. We'll just do open and close curly braces. Now the idea here is to have any views we want to position off screen and viewWillAppear happen automatically without having to manually code it each time in each view controller. And before we do any of that, we need some variables to help us keep track of each constraint's original position and an array of all current constraints on a specific manager instance. So right above the init, I'm going to…

Contents