Hacker News new | ask | show | jobs
by podgib 3721 days ago
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();
2 comments

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