libmx3 / mx3

a sample project showcasing/collecting cross platform techniques on mobile
MIT License
1.18k stars 146 forks source link

Which file is for modify? #54

Closed katopz closed 8 years ago

katopz commented 9 years ago

Current example is great but when I try to add more function to api e.g.

[api hello]

I just can't find which file (should be some.cpp right?) to edit or add method. (noob!) I even try search all getUsername from example to see how it implement and where is came from. but so far I found only generated code with warning DO NOT MODIFY!

Any hint would be nice, I'm losing half day already :turtle:

skabbes commented 9 years ago

https://github.com/libmx3/mx3/tree/master/djinni

skabbes commented 9 years ago

Read up a little bit on https://github.com/dropbox/djinni . It is a way to write code one place, and use it on both iOS and Android.

katopz commented 9 years ago

Thanks @skabbes , I just make it. :turtle:

Here's step for other noob (please correct me if i'm wrong)

get_foo(): string;
string
Api::get_foo() {
return "bar";
}
virtual string get_foo() override;
NSString * foo = [api getFoo];
NSLog(@"Hi, %@", foo);
$ make play
2015-03-22 10:08:30.103 play_objc[1049:9806] Hello, katopz
2015-03-22 10:08:30.103 play_objc[1049:9806] Hi, bar

I like to learning from the source more than reading doc (my bad habit) And I think this should be landing in wiki page for lazy dude like me ;)

Cheers!

skabbes commented 9 years ago

Dang, I let this sit for so long. Sorry. But in case others discover this, yes this is correct. The conversion between lower_under and camelCase is simply because that is the standard convention for objc.

katopz commented 8 years ago

Thanks