Is anyone else having an issue using the tableView.registerClass
method with Swift?
It no longer comes in code completion for me (nor can I use it if manually typed) but it is still in the headers...
Is anyone else having an issue using the tableView.registerClass
method with Swift?
It no longer comes in code completion for me (nor can I use it if manually typed) but it is still in the headers...
Swift 4 and 4.1. making generic methods it is very easy to register and dequeue table cell.
For swift 4
For Swift 2.2 Register For Default Cell From Class
For Swift 3.0 Register For Default Cell From Class
For Swift 2.2 Register For Default Cell From Nib
For Swift 3.0 Register For Default Cell From Nib
Note: Storyboard created cell is called prototype cell and have some procedure to register prototype cell like Nib.And Don't forget to set the cell identifier like below.
Swift has once again renamed it to
Really don't understand why they bothered so much about this particular naming
For swift 3 refer this. It works!
Inside you viewdidload function
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "LabelCell")
Switching the order in which I called registerNib and registerClass worked for me!
For some reason my app crashed when I had:
...registerNib.....
...registerClass...
But ran fine when I had:
...registerClass...
...registerNib.....
Hope that helps some of you.