We may often need to typecast variables in swift. A simple example for type casting is shown below.

Lets assume we need to access application delegate. This can be done as shown below.

var appDelegate:AppDelegate = UIApplication().delegate as AppDelegate;

As you can see the syntax for type casting is

var varName:ClassName = yourNewObject as ClassName;