Last active
May 11, 2017 22:01
-
-
Save rweichler/8ffda5ce6c861e91eb1b024d3c47bbad to your computer and use it in GitHub Desktop.
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
| objc = require 'objc' | |
| local count = 0 | |
| local function genclass(super) | |
| super = super or 'NSObject' | |
| count = count + 1 | |
| local name = 'GENERATEDCLASS_'..count..super | |
| objc.class(name, super) | |
| return objc[name] | |
| end | |
| function VIEWCONTROLLER(title, callback) | |
| local m = genclass('UIViewController'):alloc():init() | |
| m:setTitle(title or '') | |
| if callback then | |
| function m:viewDidLoad() | |
| callback(m) | |
| end | |
| end | |
| return m | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment