Q:

How does a Protocol on an instance variable in Objective-C work?

I see a lot of code such as the following as of late:
id<foo> aBar;

Typically this is something I'd see in a class declaration, such as:
@interface bar : UIViewController <UITableViewDelegate, UITableViewDataSource>

Does the above mean that aBar might be an instance of class bar and promises to have all of the methods declared in the foo protocol? 

A:

Close. It means that aBar will be an instance of a class that conforms to protocol foo. It could be bar (if that class conformed to foo) or another class that conforms to foo. All you know from that declaration is that aBar conforms to the protocol.
Also, these are only checked at compile-time, not runtime. It is possible to put an object in aBar that is not an instance of a class that conforms to foo. But the compiler will warn you about it in most cases.

