Elements includes Oxidizer, a powerful tool that can convert code from C#, Java, Objective-C and Delphi code to Oxygene, C# and Swift. This makes it easy to reuse code snippets or even whole classes found online, or to convert pieces of code from an existing project to Elements.
Oxidizer is integrated into the IDEs and can be invoked in one of two ways:
- The Paste As feature lets you paste code from your clipboard straight into your current code file, and converts it on the fly.
- The Import feature lets you select one or more code files from disk and import them into your project as new files, translating them in the process.
For platform-specific code written in C# (for .NET), the Java language (for, well, Java), and Objective-C (for Cocoa), chances are the converted code will work right away, as Elements of course uses the exact same classes and APIs as those languages, on the respective platform.
However, Oxidizer can also be useful for converting code between different platforms. For example, you might have an algorithm implemented in Java and want to use that in your .NET project. Using Paste Java as Oxygene will convert the algorithm into proper Oxygene code, you just might have to replace any Java-platform-specific APIs the code used with their .NET, Cocoa or Sugar equivalent to use that same code on different platforms.
Oxidizer is also useful for migrating Delphi code to Oxygene. As in the previous example, Oxidizer will not magically get rid of the Delphi RTL or VCL APIs your code uses, but it will adjust the core language syntax for the differences between Delphi and Oxygene.
Oxidizer does not currently support converting from and to all language combinations. In particular, Delphi code can only be converted to Oxygene, and conversion from Swift is not available yet.
The following conversions are supported:
These conversions are currently being worked on and will be coming in a future update:
Reporting Conversion Issues
While Oxidizer's support is extensive, it is always possible that there will be some code constructs it does not handle yet. If you encounter any problems, we would appreciate bug reports: simply paste the original code (and ideally the wrong result produced by Oxidizer) into an email and send it to firstname.lastname@example.org or post a bug report on Talk.
- Several new language imports for Oxidizer are new in Version 8.1, including Java to C# and conversions to Swift.