Created
March 24, 2017 21:46
-
-
Save darknoon/ce9d5dfa78889ea9585c4f0d15e97087 to your computer and use it in GitHub Desktop.
How to use ObjCClass library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MyClass = new ObjCClass({ | |
classname: 'MyClass', | |
superclass: NSButton, | |
_private: 'initial', | |
init() { | |
log("my custom init code. no need to call super here "); | |
this._private = 'test'; | |
}, | |
test() { | |
log("test: " + this._private); | |
}, | |
description() { | |
const ret = `<MyClass _private=${this._private}>`; | |
return NSString.stringWithString(ret); | |
} | |
}) | |
const obj = MyClass.new(); | |
log(`obj ${obj}`); | |
obj.test(); | |
// But this is more elegant! | |
obj._private = "efgh"; | |
obj.test(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you do want to call super and use the result: