From 2f6adbae3c246d208b2d97237bda143b3d406bbd Mon Sep 17 00:00:00 2001 From: cacaodev Date: Sun, 7 Feb 2016 11:19:26 +0100 Subject: [PATCH] Documentation for -loadViewWithCompletionHandler: Also clarified a note in -loadView doc. --- AppKit/CPViewController.j | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/AppKit/CPViewController.j b/AppKit/CPViewController.j index 22e30789b..559a12f05 100644 --- a/AppKit/CPViewController.j +++ b/AppKit/CPViewController.j @@ -149,9 +149,10 @@ var CPViewControllerCachedCibs; If you use Interface Builder to create your views, and you initialize the controller using the initWithCibName:bundle: methods, then you MUST NOT override - this method. The consequences risk shattering the space-time continuum. - - Note: The cib loading system is currently synchronous. + this method. + + @note When using this method, the cib loading system is synchronous. + See the loadViewWithCompletionHandler: method for an asynchronous loading. */ - (void)loadView { @@ -176,6 +177,15 @@ var CPViewControllerCachedCibs; _view = [CPView new]; } +/*! + Loads asynchronously the cib and creates the view that the controller manages. + + @param aHandler A function passing the loaded view as the first argument + and a network error or nil as the second argument: function(view, error). + + @note If the view has already been loaded, the completion handler is run immediatly + and the process is synchronous. +*/ - (void)loadViewWithCompletionHandler:(Function/*(view, error)*/)aHandler { if (_view)