CTBlockDescription
Oliver Letterer’s CTBlockDescription is a class for introspecting block Objective-C blocks (via Ole Begemann).
View ArticleObjective-C Blocks Quiz
Bryan Klimt: Do you really know how blocks work in Objective-C? Take this quiz to find out. Educational, although I think it confuses what works in the current implementation with what is contractually...
View ArticleBlock Debugging
Damien DeVille: We are mostly interested about the first method argument (the third argument of the objc_msgSend function) which happens to be a stack block. Now, obviously we know exactly what the...
View ArticleRXCollections
Rob Rix’s RXCollections offers: Folds, maps, filters, and detects for Cocoa collections (including your own), with as little chaff as possible. The interesting part is that: Maps and filters take a...
View ArticleReactiveCocoa Explanation
Josh Abernathy: Because we treat all the inputs to our app as different things—a touch event here, a web response there—we can’t combine them in any meaningful way. We can’t transform them uniformly....
View ArticleNSEnumeratorLinq
Ash Furrow: Anton Bukov has done a great job replicating the LINQ framework in the Foundation collections classes.For those of you who aren’t former .Net fanboys, LINQ is the gem of .Net development....
View ArticleLeak-Free Recursive Blocks
Jeremy W. Sherman (via Romain Briche): So you need both a strong and a weak reference to your block. And the block needs to be stored in the strong reference first, so you anchor it to this world. And...
View ArticlePresenting BlockAssert
Steven Fisher: For various reasons, you sometimes can’t use NSAssert in a block easily. I’m going to explain why and describe a new macro, BlockAssert, which solves this.
View ArticleLazy Evaluation and Streaming With NSFastEnumeration
Rob Rix: Since Wolf and Michael’s posts, the old RXMap that took a second argument as the collection to fold the mapped results into is gone. In its place is an RXMap which returns an object conforming...
View ArticleRXTraversal
Rob Rix: Perhaps more damningly, it’s particularly difficult to compose NSFastEnumeration, e.g. to produce objects based on the enumeration of some other object, as with a map, or worse, a convolution...
View ArticleAvoid Null Checks by Replacing Finders With Tellers
Michael Feathers:The person method accepts an id for a person and a block. If the person is found the block is called with the person. Otherwise it isn’t. Elegant, eh? And, there are no nulls.Lots of...
View ArticleEffective Objective C 2.0
Mark Bernstein on Matt Galloway’s Effective Objective C 2.0: This book is organized and presented as an Objective C homage to Scott Meyers’ classic work, Effective C++. The new book is good and...
View ArticleFrom C Declarators to Objective-C Blocks Syntax
Nils Hayat: In this post, I start with the simplest C declarator and build in complexity until we get to Objective-C blocks syntax. It took me a while to get block syntax but once you understand how it...
View ArticleNSNotificationCenter With Blocks Considered Harmful
Great post from Drew Crawford: This could be, I think, the single biggest API blunder in iOS. (Except maybe iCloud Core Data.) I have debugged issues that were root-caused to this misleading API more...
View ArticleNSArray+Functional
Nicolas Seriot has written a category on NSArray to add map, filter, and reduce functionality. You pass a selector and a variable number of arguments, and it performs the selector on each object in the...
View ArticleBlock-Based Dictionary Enumeration Can Be Pretty Slow
You’d expect that -[NSDictionary enumerateKeysAndObjectsUsingBlock:] would be faster than fast-enumerating the keys and then looking up the objects, as it could access both at the same time while...
View ArticleJava 8
Andrew Binstock: What makes Java 8 so compelling is its embrace of the functional programming metaphor. This embrace has two primary expressions: the use of closures (or as Java calls them, “lambdas”)...
View ArticleSwift: Objective-C Without the Smalltalk
David Owens II has some criticisms along this line that differ from those I mentioned before (via Christoffer Lernö): Gone is the dynamic nature of ObjC; it has instead been replaced by a rigid,...
View Article@weakify and @strongify Macros
Arkadiusz Holko: Original implementation of @weakify and @strongify macros is complex because they accept more than one parameter. To make the analysis simpler, we’ll introduce our own versions,...
View ArticleWeak and Unowned References in Swift
Hector Matos: At this point we have a retain cycle. You see, closures in Swift behave exactly like blocks in Objective-C. If any variable is declared outside of the closure’s scope, referencing that...
View Article