-
-
Notifications
You must be signed in to change notification settings - Fork 73
Make AnyClass generic? #842
Copy link
Copy link
Open
Labels
A-frameworkAffects the framework crates and the translator for themAffects the framework crates and the translator for themA-objc2Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesAffects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesenhancementNew feature or requestNew feature or request
Metadata
Metadata
Assignees
Labels
A-frameworkAffects the framework crates and the translator for themAffects the framework crates and the translator for themA-objc2Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesAffects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesenhancementNew feature or requestNew feature or request
Some APIs have bounds on classes, such as
-[NSWindow restorationClass]:@property (nullable, assign) Class<NSWindowRestoration> restorationClass;This effectively says "whatever class is used here must conform to
NSWindowRestoration".A similar thing is actually needed for
-[UIView layerClass], ideally that one should probably say "whatever class is used here must be a subclass ofCALayer" (but I don't think Objective-C has a way to express that).To model this, it might make sense to make
AnyClassgeneric? Something like:And a few methods for (unsafely probably) converting the class' generic.