Open izuchukwu opened 6 years ago
I like the feature, though it now occurs to me that it might be a nicer API if we had something like this:
class MyClass extends ObjcClass {
static classMethod() {
// ...
}
instanceMethod() {
// ...
}
}
Instead of:
const cls = ObjcClass({
instanceMethod() {
}
classMethods: {
classMethod() {
}
}
});
What do you think? That might be more of a "1.0" version :)
If you update docs, I am in support of this feature as a temporary fix, though.
@darknoon That would be quite nice! One way might be by requiring some sort of super this
, and the ObjCClass
constructor would inspect your extended class and use that to generate the Objective-C equivalent? Or perhaps a higher-level ObjCClass.register(myClass)
afterwards. Agreed, would make for a good "1.0" :)
I've updated the readme with information on using this feature as well as on subclassing, which might be helpful as well.
@darknoon Working with class methods recently so thought it'd be helpful to suggest the changes upstream. This reserves 2 properties, principally
classMethods
, accepting an object of methods to add as class methods similar to how instance methods are added at object root. Thoughts?