In another thread, I saw this construction:
protocol AssetInstance : class {
var identifier: String { get set }
}
Which, to my astonishment, compiles. I can't seem to find documentation for this use of the keyword "class".
Could I get a pointer, please?
krilnon
(Kyle Murray)
2
It's another name for AnyObject.
This proposal merges the concepts of class and AnyObject , which now have the same meaning: they represent an existential for classes. To get rid of the duplication, we suggest only keeping AnyObject around. To reduce source-breakage to a minimum, class could be redefined as typealias class = AnyObject and give a deprecation warning on class for the first version of Swift this proposal is implemented in. Later, class could be removed in a subsequent version of Swift.
2 Likes
Tino
(Tino)
4
You are lucky —I tell people all the time to use AnyObject; I guess the old spelling will never fade away 
1 Like
phoneyDev
(Stern)
5
It's been deprecated, or something.
Nevin
6
Personally, I think class is much clearer in its meaning than AnyObject.
1 Like
Hacksaw
7
Not for me. Not in lowercase. It looks like a mistake. If is was Class, mirroring Self, maybe.
AnyObject is fine for me.
2 Likes