learn-co-curriculum / mobile-development-curriculum

Other
0 stars 0 forks source link

III.ii.04 - reading-objc-casting #38

Closed markedwardmurray closed 9 years ago

markedwardmurray commented 9 years ago

This subject can get into the weeds really quickly. It's mostly important for pulling objects out of collections and in subclassing UITableViewCells.

Worth discussing type id as "any class" or "unspecified class"

Is worth explaining the "magic" that at runtime all objects are type id, that classes are an abstraction to help the compiler catch when references will crash into each other? Could be an advanced note? Don't wanna blow minds too early.

AnnJohn commented 9 years ago

Iceboxing for now and Mark will close when he's done with the issue

markedwardmurray commented 9 years ago

same notes as above, this may not really need to be here. The only common time to use casting is in cases where a UITableViewCell doesn't load right, so it's debatable whether is really that necessary to the curriculum. It's a useful exercise in expanding one's understanding of typing in Objective-C and how class definitions work under the hood, but Swift handles this differently so there's no direct transcription value for the future.

markedwardmurray commented 9 years ago

https://github.com/learn-co-curriculum/reading-objc-Casting

markedwardmurray commented 9 years ago

Tim: CGFloat example, use integer variable, not value.