5 ms·
Show HN: Objective-C to Swift or to Java Instant Code Block Converter
- brudgers 10y agoIf it meets the guidelines, this might make a good "Show HN". Guidelines: https://news.ycombinator.com/showhn.html https://news.ycombinator.com/showhn.html
- Ernestovitch 10y agoThanks, I will do this.
- jaoued 10y agoBy 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.
- IMcD23 10y agoI 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
- Ernestovitch 10y agoThe 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 https://docs.myappconverter.com/#ios-to-android
- podgib 10y agoI 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();
- UnfalseDesign 10y agoI 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.
- Ernestovitch 10y agoThank 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/ https://docs.myappconverter.com/mapping_tech/ios2android/ iOS project converion : https://apps.myappconverter.com/users/sign_up https://apps.myappconverter.com/users/sign_up
- Ernestovitch 10y agoYou 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/ https://www.myappconverter.com/
- fishnchips 10y agoWell 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?
- Ernestovitch 10y agoWe 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 https://github.com/MyAppConverter For more information about mapping technology: https://docs.myappconverter.com/ https://docs.myappconverter.com/
- onecooldev24 10y agoIs there command line utility for this?
- Ernestovitch 10y agoNo,but you can use our Xcode plugin to convert your Objc code to Swift code : https://www.myappconverter.com/instaswift https://www.myappconverter.com/instaswift