Key Concepts: Dynamics

UICollectionView allows us to display content in a flexible way, often times in a grid. UITableViews and UICollectionViews have very similar setups. Connect a data source and a delegate and you're halfway there!

For example:

UITableView method UICollectionView method
cellForRowAtIndexPath:(NSIndexPath *)indexPath cellForItemAtIndexPath:(NSIndexPath *)indexPath
numberOfRowsInSection:(NSInteger)section numberOfItemsInSection:(NSInteger)section
didSelectRowAtIndexPath:(NSIndexPath *)indexPath didSelectItemAtIndexPath:(NSIndexPath *)indexPath

A UICollectionView's layout is configured by a class called UICollectionViewLayout. In general, we will be using a predefined UICollectionViewLayout called UICollectionViewFlowLayout. This will arrange the items in a grid.

There is a physics engine built into UIKit! This physics engine allows non-gaming applications to take advantage of real world simulated properties such as elasticity and gravity. Springy view animations and deceleration are the result of this powerful engine that we have at our fingertips.

UIDynamicAnimator and behaviors are all hierarchically connected.

Blocks are snippets of code that can be passed around to objects. An integral part of GCD (Grand Central Dispatch), blocks provide a native mechanism to accomplish asynchronous tasks.

The block syntax is tricky, it takes developers a long time to internalize the block structure but don't worry about that. Blocks are way to pass around snippets of code into a method as you would a variable. You can tell a block by the ^ symbol used before the {. Use the built in Xcode code assistant to fill out the block syntax for you.

You should have a pretty good handle on these concepts: