Why do I need to specify self when registering a UITableViewCell for a tableview in the register method?

Viewed 57

I'm looking to get a better understanding of why self needs to be called on the UITableViewCell type in this method for it to compile.

ableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
1 Answers

Because the signature of the .register method is asking you to pass the cell class as a parameter?

func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)

Or, were you wondering, why is the signature of the .register method such in the first place?

If that is the case, you can't just simply pass Type as a function argument, the function argument has to be some value.

Related