Home Features Docs Blog Support GitHub

Swift API vs ObjectiveC API

(Blueneogeo) #1


Is there a particular reason that the MOE libraries target the ObjectiveC iOS API instead of the Swift API?

The Swift one is more modern and has more Java-like naming after all.

(Gergely Kis - Migeran) #2


the reason is mostly historical: when we started working on MOE (or more precisely, its predecessor “Migeran for iOS”), Swift did not exist yet. Nor did the attributes that were added by Apple to the Objective-C header files to support the Swift -> ObjC bridge.

Our goal with Nat/J and the generator was to work with any ObjC code thrown at it.

That said, we are thinking about creating a new version of the bindings that will follow the Swift naming conventions. This will require changes to the binding generator to support the new ObjC attributes + change the code generator to generate more “Swifty” bindings + changes in the Nat/J runtime to support e.g. Swift like constructors.

Best Regards,

(Damian Wieczorek) #3

Hi Gergely,

That would definitely be nice. Similarly, do you think any effort would be put into generating the bindings in Kotlin in addition to Java? The main benefit for that would be making use of named arguments, which would definitely cut down on the length of method names.


(Christian Ringshofer (Das Weiße Lama)) #4

This will definitely be a must have!
Since I released a very popular app on the iTunes App store which has been built with Multi-OS-Engine, I’m afraid of not being able to make any updates in the future when framework by framework will steadily switch to swift.

There have already been some frameworks dropping the support for objective-c, since swift became so popular. Where does your team need help so far? It seems like your a bit overstrained with the changes which have to be made for such a big change.

Best regards!

(Ivan) #5

good to hear that! Any plan when this will kick start?