在Swift 4中,您可以使用新的&符号(在确认UIViewController和UITableViewDataSource的参数示例下面:
func foo(vc: UIViewController & UITableViewDataSource) { // access UIViewController property let view = vc.view // call UITableViewDataSource method let sections = vc.numberOfSectionsInTableView?(tableView)}


