Hacker News new | ask | show | jobs
Show HN: Objective-C to Swift or to Java Instant Code Block Converter (apps.myappconverter.com)
13 points by Ernestovitch 3721 days ago
5 comments

I copy and pasted in the example code from the link at the bottom, and the code it produced is not valid java code. It still includes Obj-C types (eg. NSString) and is repeating method names. eg:

  NSMutableArray  array=NSMutableArray.arrayarray();
You are right, since the generated code is only respecting Java syntax. To have a compiled java code, you can submit an Xcode project to convert it to Swift or Android on https://www.myappconverter.com/
I got similar results. I took some sample code from the Apple SpriteKit documentation:

  CGFloat distance = sqrtf((clickPoint.x-charPos.x)*(clickPoint.x-charPos.x)+
                             (clickPoint.y-charPos.y)*(clickPoint.y-charPos.y));
And got this in Swift:

  var distance:CGFloat  = sqrtf((*((clickPoint.y-charPos.y)*()
Most of the code I put in converted to Swift correctly (though it wasn't efficient Swift code) but the above line was just plain wrong. So, it still seems a little buggy but it is a good idea. Like you pointed out, it is only useful for Objective-C to Swift since the Foundation framework is not available in Android.
Thank you for testing the service, we will fix the issue you have mentionned. This service gives just code snippet conversion. You can try an iOS project conversion to swift or Android. We have created a mapping technolgy to support iOS frameworks,Foundation and others are mapped to android API that will be included in the converion output project

Our mapping technology : https://docs.myappconverter.com/mapping_tech/ios2android/

iOS project converion : https://apps.myappconverter.com/users/sign_up

By way of intro, we've been working for the last two years on this project. Our goal is “to enable mobile developers and application owners to quickly bring their applications to any mobile device, without compromising quality or performance.”

The code block converter is just a free tool, which is part of bigger platform called MyAppConverter.

We've built MyAppConverter as an instant and automatic native to native code conversion platform that helps achieve our goal. Our technology is based on semantic code transformation and model driven engineering.

By the way, the entire platform is free to use as a self-service and we currently support Objective-C to Java (Android) and to Swift.

Feedback much welcome.

I don't see any mention of what kind of code you are enabling me to convert between platforms. The majority of code in an app is relatively platform-specific. i.e. Networking code, all UI code, sensors, etc. All code except for probably models.

Are you doing purely language-based conversion or platform API conversion as well? For example, UITableView -> ListView

The code block converter is converting any code from Objc syntax to Swift/Java syntax You can do a free iOS project conversion using MyAppconverter.com. This conversion will generate a report for code features that could be converted and you will have a generated project containing the supported features equivalent. To have an idea about the supported frameworks: https://docs.myappconverter.com/#ios-to-android
Well done - the technology is pretty amazing if it lives up to its promise. I'd be curious to know what you use behind the scenes to parse Objective-C? Do you build parse trees with clang or is there some other black magic going on?
We have created an ObjC parser using its grammar. our converion service convert iOS project code source to android or swift project. This conversion is done using syntaxic and semantic mapping technology. You can check out converion samples here https://github.com/MyAppConverter

For more information about mapping technology: https://docs.myappconverter.com/

Is there command line utility for this?
No,but you can use our Xcode plugin to convert your Objc code to Swift code : https://www.myappconverter.com/instaswift
If it meets the guidelines, this might make a good "Show HN".

Guidelines: https://news.ycombinator.com/showhn.html

Thanks, I will do this.