DataBasedViewController
open class DataBasedViewController : UIViewController
Provides a basic ViewController capable of perform data synchronization operations.
-
A view to be displayed as a courting, covering entire view, when fetching data.
Declaration
Swift
@IBOutlet open weak var courtainView: UIView?
-
Prepares the ViewController to become visible. Checks if any data operation must be executed.
Declaration
Swift
override open func viewWillAppear(_ animated: Bool)Parameters
animatedIf presentation must use animation to become visible
-
Performs data synchronization if
shouldSyncData()validates.During data synchornization,
willSyncData(), thensyncData()and finallydidSyncData()will be called.If not data synchronization is performed, only
didSyncData()is called.Declaration
Swift
@objc open func performDataSync() -
If
courtainViewis defined, makes it visible.Declaration
Swift
open func showCourtainView() -
If
courtainViewis defined, hides it.Declaration
Swift
open func hideCourtainView()
-
Validates if data synchronization must be executed.
By default, returns always
true.Declaration
Swift
open func shouldSyncData() -> Bool -
Data synchronization will be executed.
By default, executed
showCourtainView()Declaration
Swift
open func willSyncData() -
Executes data synchronization.
This method is intended to be overriden by child ViewControllers in order to implement proper data synchronization.
By default, does nothing.
Declaration
Swift
open func syncData() -
Data synchronization was completed.
By default, executes
hideCourtainView()Declaration
Swift
open func didSyncData()
View on GitHub
DataBasedViewController Class Reference