to pare locations down to a selected range. For this, we’ll use NSPredicates and sort descriptors - one of the more powerful Foundation API’s. But first we need to make a new model - an MSRange model - that will allow us to easily move ranges around the app.
reference to our original locations datasource. Being reference types, you can’t just assign copiedDataSource = dataSource. Anything that happens to copiedDataSource will affect dataSource because they share the same pointer. In order to copy objects entirely, with a new chunk of memory and a new pointer, we must use NSCopying. The object being copied must conform to the NSCopying protocol. Under the hood, copyWIthZone: is called on the object being copied.
into UITableView with reusable cells, animated index paths, and delegates for many standard actions. Let’s use the moveRowAtIndexPath: and canMoveRowAtIndexPath: delegate methods to allow the user to reorder the set of location types. A little-used but powerful feature.
just delegate methods like cellForRowAt IndexPath or didSelectRowAt IndexPath Our settings view controller acts as a delegate for the cells being reordered. Certain events (like the reordering of cells) trigger these methods to be called. The view controller implements them
and UITableViewCell. No importing of third-party libraries and no having to write hundreds of lines of code (writing this app in the C you wrote in CS50).
objects: 1) We keep a mental model of the object across maps and tables. 2) We’re passing a 64 bit pointer around instead of a potentially huge chunk of memory. 3) The object is easily extendable.. What are other things we can do with our objects?
CS50 IDE, Instruments is like a super Valgrind There are the standard tools for profiling memory leaks and threading bugs but also tools for: • graphics usage • speed tests for Core Data fetches • a busy network layer • zombie objects • UI automated interactions (finger tapping, swiping, long-press) Much more..