Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Conversation

izuchukwu
Copy link

@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?

@darknoon
Copy link
Owner

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.

@izuchukwu
Copy link
Author

izuchukwu commented Oct 27, 2017

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants