Let's recap how we broke the work down into independent parts:
We can turn each of these blocks of work into separate operations. First, let's create an operation to scale and crop each photo.We define an operation by sub-classing the Operation class, so in the project, create a new Swift file and call it PhotoResizeOperation.swift.
In the simplest Operation implementation, we only need to override one method, main(), so let's copy and paste the relevant code from our generatePhotobook method. This main() method will be executed when the operation starts:
import UIKitclass PhotoResizeOperation: Operation { override func main() ...