Porting original tutorial from Objective-C to Swift