Reputation: 12670
As a sanity check, I would like to assert in viewDidLoad
that a UITableViewController
(i.e. self
) is set both as dataSource
and delegate
of its tableView
. How can I put this in Swift 3, where (unlike with Objective-C) additional type casts are needed? This still leads to syntax errors:
assert(tableView.dataSource == self)
assert(tableView.delegate == self)
Upvotes: 1
Views: 46
Reputation: 160
You can do this using the object instance equality operator '===':
assert(tableView.dataSource === self)
assert(tableView.delegate === self)
Upvotes: 1