Converted the Main view controller to Swift