Skip to content
/ spa Public
forked from hzfanfei/spa

hotfix on ios ( Inspired by wax )

License

Notifications You must be signed in to change notification settings

memoryxy/spa

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SPA

lua hotfix ios app

before run spa demo

cd serverSample

node server.js

situation 1

Objective-c

@implementation ViewController

- (void)doSomeThing
{
    [self.view setBackgroundColor:[UIColor grayColor]];
}

lua

spa_class("ViewController")

function doSomeThing(self)
    self:view():setBackgroundColor_(UIColor:grayColor())
end

situation 2

Objective-c

@implementation ViewController

- (void)doSomeThing:(UIColor *)color
{
    [self.view setBackgroundColor:color];
}

lua

spa_class("ViewController")

function doSomeThing_(self, color)
    self:view():setBackgroundColor_(color)
end

situation 3

Objective-c

@implementation ViewController

- (void)doSomeThing:(UIColor *)color
{
    [self.view setBackgroundColor:color];
}

lua

spa_class("ViewController")

function doSomeThing_(self, color)
    self:ORIGdoSomeThing_(color)
end

situation 4

Objective-c

@implementation SUBViewController

- (void)doSomeThing:(UIColor *)color
{
    [super doSomeThing:color];
}

lua

spa_class("ViewController")

function doSomeThing_(self, color)
    self:SUPERdoSomeThing_(color)
end

situation 5

Objective-c

@implementation SUBViewController

- (void)doSomeThing:(void(^)(int i))block
{
    block(5);
}

lua

spa_class("ViewController")

function doSomeThing_(self, block)
    block(5)
end

situation 6

Objective-c

@implementation ViewController

- (void(^)(void))doSomeThing
{
    void(^block)(void) = ^() { };
    return block;
}

lua

spa_class("ViewController")

function doSomeThing_(self, block)
    return function (i)  end
end

Objective-c

@implementation ViewController

- (void(^)(int))doSomeThing
{
    void(^block)(int) = ^(int i) { };
    return block;
}

lua

spa_class("ViewController")

function doSomeThing_(self, block)
    return block(function (i)  end, 'v', {'i'})
end

situation 7

Objective-c

@implementation ViewController

- (void)doSomeThing_(CGPoint)p
{
    int x = p.x;
    int y = p.y;
}

lua

spa_class("ViewController")

function doSomeThing_(self, p)
    local x = p.x1
    local y = p.x2
end

Objective-c

@implementation ViewController

- (CGPoint)doSomeThing
{
    CGPoint p;
    p.x = 3;
    p.y = 4;
    return p;
}

lua

spa_class("ViewController")

function doSomeThing(self)
    return {3,4}
end

situation 8

Objective-c

@implementation ViewController

- (void(^)(CGPoint, CGRect))doSomeThing
{
    void(^block)(CGPoint, CGRect) = ^(CGPoint, CGRect) {
        
    };
    return block;
}

lua

spa_class("ViewController")

function doSomeThing()
    return block(function (point, rect)  end, 'v', {'{CGPoint=gg}', '{CGRect=gggg}'})
end

situation 9

@implementation ViewController

- (void)doSomeThing
{
    ...
    [self doSomeThingInternal];
    ...
}

- (void)doSomeThingInternal
{
    ...
}

lua

class_deep('ViewController', 'doSomeThing', 'ViewController', 'doSomeThingInternal', function ()  end) -- remove doSomeThingInternal impl in doSomeThing only

About

hotfix on ios ( Inspired by wax )

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 67.6%
  • Objective-C 29.4%
  • C++ 1.3%
  • Lua 1.3%
  • Shell 0.2%
  • Ruby 0.1%
  • JavaScript 0.1%