Passing data back and forward between view controllers

I will go straight to the point and tell you how to send data back and forward in different situations.

This code was written in Swift 3

Sending data forward using Segue

If you are navigating from ViewControllerA to ViewControllerB using Segue called “toViewControllerB” then do the following steps Continue reading “Passing data back and forward between view controllers”

UIViewController lifecycle explained

UIViewController Lifecycle

In this tutorial we will explain the lifecycle of UIViewController in iOS, these methods will run in the following order:

1- init?(coder aDecoder: NSCoder)

If you are using storyboards this is where the controller is initialized, it is called one time only during the view controller lifetime.

2- loadView()

Creates the view that the controller manage, the view controller calls this method when its view property is requested but is currently nil.

This method loads or creates a view and assign it to the view property. Continue reading “UIViewController lifecycle explained”