Any vs. AnyObject in Swift 3.0
Luna An
1.6K16

There is one problem here.You have observed each and everything right except one thing.
When you say that ‘Any’ alone works fine in swift 3,I think you are wrong.Check this code snippet.
func addLeftController(_ leftVC:AnyObject?){

//leftVC = storyboard?.instantiateViewController(withIdentifier: “LeftViewController”) as? LeftViewController

self.view.addSubview((leftVC?.view)!)

addChildViewController(leftVC! as! UIViewController)

leftVC?.view.frame = CGRect.init(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height)

leftVC?.didMove(toParentViewController: self)

}

Replace ‘AnyObject’ by Any and it won’t work.Please correct me if I’m wrong.