I see that IB job is to unarchive the Nib file, load the objects in the Nib and set those to IBOutlet properties. Some people even use IB as DI framework
But IBOutlet can be private, I mean it can be declared in class extension or implementation section. So how can IB interact with these private IBOutlet?
@interface FPMovieBottomViewController ()
@property (weak, nonatomic) IBOutlet UILabel *usernameLabel;
@end
As described in the Note here: Customizing Existing Classes
By adding the class extension shown above, redeclaring the uniqueIdentifier property as a readwrite property, a setUniqueIdentifier: method will exist at runtime on every XYZPerson object, regardless of whether other source code files were aware of the class extension or not.
The compiler will complain if code in one of those other source code files attempts to call a private method or set a readonly property, but it’s possible to avoid compiler errors and leverage dynamic runtime features to call those methods in other ways, such as by using one of the performSelector:... methods offered by NSObject. You should avoid a class hierarchy or design where this is necessary; instead, the primary class interface should always define the correct “public” interactions.
If you intend to make “private” methods or properties available to select other classes, such as related classes within a framework, you can declare the class extension in a separate header file and import it in the source files that need it. It’s not uncommon to have two header files for a class, for example, such as XYZPerson.h and XYZPersonPrivate.h. When you release the framework, you only release the public XYZPerson.h header file.
I've highlighted the parts where we can modify existing classes with dynamic runtime. In other languages such as ruby or python this is called monkey-patching.
There's a good article about this: monkeypatching-for-humans. But, in the example given, extension only allows one to add functionality to existing classes, not replace, remove or override. In objc, an accurate example of monkey patching is method-swizzling. Which is not always harmful, because developers have been taking advantage of it to build something like Xcode plugins, or mogenerator.