Latest 1.1.5
Homepage https://github.com/hzfanfei/spa
License hzfanfei
Platforms ios 8.0, requires ARC
Authors

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

Latest podspec

{
    "name": "spa",
    "version": "1.1.5",
    "summary": "lua hotfix solution",
    "description": "hope to online",
    "platforms": {
        "ios": "8.0"
    },
    "homepage": "https://github.com/hzfanfei/spa",
    "license": "hzfanfei",
    "requires_arc": true,
    "authors": {
        "hzfanfei": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hzfanfei/spa.git",
        "tag": "1.1.5"
    },
    "source_files": [
        "spa",
        "spa/Spa/**/*.{h,m,c}"
    ],
    "ios": {
        "vendored_libraries": [
            "spa/Spa/libffi/libffi_sim.a",
            "spa/Spa/libffi/libffi.a"
        ]
    }
}

Pin It on Pinterest

Share This