在Swift3中NSIndexPath初始化是如何改变的?

我试图跟随苹果的开始开发iOS应用程序(Swift)教程,并已几乎完成。 我不得不修改本教程的几个部分,因为我使用Xcode 8(我认为使用Swift 3而不是Swift 2)。 但是,我遇到以下编译器错误,我不知道为什么:

Argument labels (forRow:, inSection) do not match any available overloads

在以下function中:

 @IBAction func unwindToMealList(sender: UIStoryboardSegue) { if let sourceViewController = sender.sourceViewController as? MealViewController, meal = sourceViewController.meal { // Add a new meal let newIndexPath = NSIndexPath(forRow: meals.count, inSection: 0) meals.append(meal) tableView.insertRows(at: newIndexPath, with: .bottom) } } 

我猜测,有一个不同的初始化NSIndexPath在Swift 3中更改,但我找不到它。 难道我做错了什么?

谢谢,

NSIndexPath已被更改为IndexPath

尝试IndexPath(row: Int, section: Int)

API参考:indexpath

Swift 3.0开发人员预览