what is the "as" keyword in swift

ios, swift

Solution

You use the `as` keyword to cast data types. UIWindow `rootViewController` is of type `UIViewController`. You downcast it to `UISplitViewController`.

Problem

I am quite new to Swift and iOS. I am just reading some sample codes. There is a line I cannot understand: ``` let splitViewController = self.window!.rootViewController as UISplitViewController ``` What does "as" do here? Thanks

Original source