1

I am trying to declare a reuse identifier associated to a UITableView subclass in swift.

From my understanding I would like to declare an class stored property (not an instance one) so i have access via: MyCustomTableCell.ReuseIdentifer.

Here is what I was trying:

class MyCustomTableViewCell : UITableViewCell {

    class let ReuseIdentifier = "MyCustomTableViewCellReuseIdentifier"

}

The compiler mentions that class attributes are not supported yet. How to declare such kind of constants associated to a class type in a clean way?

martin
  • 125
  • 1
  • 1
  • 7

1 Answers1

1

It's just as the compiler said, constants / variables cannot be declared at the class-level yet. The "yet" in the error is key: Apple does intend to add support for this feature, and if you wait a few Xcode releases, it should be available.

Austin
  • 5,625
  • 1
  • 29
  • 43