braces and the ‘in’ means it’s a block type variable but what is that exactly... A block variable encapsulates code that is executed at either a different time, on a different thread, or both. In our case, the code in the block isn’t executed until the view controller leaves the Window.
log out “reached end of didTapDimiss scope” before “completion block fired”. This is counter to what normally happens where code is executed sequentially from top to bottom.
to execute the block variable until some event has occurred. In our case, the event is the view controller sliding off of the main window. A block doesn’t have to be inline. We can declare it as a separate variable:
A tap gesture will show and hide the distance label while a pan gesture will allow us to move the image view around the detail’s view. Recognizers are easy to set up and offer a powerful API for developers to utilize
and assign them to views. Some Caveats: 1) A gesture recognizer can be added to any subclass of UIView 2) Two views cannot share a gesture recognizer. Last one in! 3) Often you have to set a view’s isUserInteractionEnabled property to true. 4) Do not overuse gesture recognizers - see Apple’s Human Interface Guidelines. 5) If you were to add ‘pan’ to the dismiss button, it still fires even after you pan it around the view, this fact has allowed many a developer to create simple 2D games.
code is a custom animation. A class method on UIView that takes two blocks handling both the animation, and the code to execute when the animation finishes.
a ton of work to create an API that is simple for us to implement. Just toss your desired animation inside the curly braces of the animation block and let UIKit do the rest: