Quantcast
Channel: Defining 'UITableViewCell' variable in Swift 2.0 - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by Buntylm for Defining 'UITableViewCell' variable in Swift 2.0

$
0
0

Because the non optional type cannot be compared with nil (Only optional variables contains nil value). Like if you want to check nil then just use that way. i implemented it in Playground

let tableView = UITableView()
let index = NSIndexPath()
var cell:UITableViewCell! = tableView.dequeueReusableCellWithIdentifier("")
//then make check for nil if you want
if (cell == nil) {
    print("its nil")
} else  {
    print("not nil")
}

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>