Elements RTL

Elements RTL (also referred to as RTL2) is a new cross-platform base library and abstraction layer that allows you to write code (in any of the four Elements languages) that can easily be shared across all four platforms (.NET, Cocoa, Java/Android, and Island).

Elements RTL provides abstractions for common low-level types such as Strings ad Collections, and tasks such as value conversions, text encoding and mathematical operations. It also includes fully native, cross-platform XML and Json document implementations, HTTP access, and more.

Elements RTL supersedes and replaces Sugar. Applications using Sugar should port over to Elements RTL easily, since many APIs are the same or similar.

Using Elements RTL

A pre-compiled version of Elements RTL is included with Elements, and can be added to your projects via the Add References dialog in Fire or Visual Studio, where the Elements library should show automatically. The New Project dialog in Fire will also give you the option to start new projects based on Elements RTL.

Simply adding the reference and adding the RemObjects.Elements.RTL namespace to your uses/import statements will make the Elements RTL classes available for you. For ease of use, we recommend adding RemObjects.Elements.RTL to the global "Default Uses" Project Setting.

Classes and Types

Currently, the following major types are supported/implemented. Unless otherwise noted, all parts of Elements RTL are available across all platforms, including Island.

Classes

Enums

Exceptions

Attributes

Aliases

Alias Type
ApplicationContext
Object  .NET, .NET Standard, Iodine, Toffee
Object  Island
ArgumentException
System.ArgumentException  .NET, .NET Standard
IllegalArgumentException  Iodine
ArgumentException  Island
ImmutableObjectDictionary
ImmutableDictionary<String, Object>  .NET, .NET Standard, Iodine
ImmutableDictionary<String, Object>  Island
ImmutableDictionary<String, NSObject>  Toffee
ImmutablePlatformBinary
MemoryStream  .NET, .NET Standard
ByteArrayOutputStream  Iodine
MemoryStream  Island
NSData  Toffee
ImmutableStringDictionary
ImmutableDictionary<String, String>
ImmutableStringDictionary2
ImmutableDictionary<String, ImmutableDictionary<String, String>>
ImmutableStringDictionary3
ImmutableDictionary<String, ImmutableDictionary<String, ImmutableDictionary<String, String>>>
ImmutableStringDictionary4
ImmutableDictionary<String, ImmutableDictionary<String, ImmutableDictionary<String, ImmutableDictionary<String, String>>>>
NotImplementedException
System.NotImplementedException  .NET, .NET Standard
NotImplementedException  Island
NotSupportedException
System.NotSupportedException  .NET, .NET Standard
UnsupportedOperationException  Iodine
NotSupportedException  Island
ObjectDictionary
Dictionary<String, Object>  .NET, .NET Standard, Iodine
Dictionary<String, Object>  Island
Dictionary<String, NSObject>  Toffee
PlatformBinary
MemoryStream  .NET, .NET Standard
ByteArrayOutputStream  Iodine
MemoryStream  Island
NSMutableData  Toffee
PlatformDateTime
DateTime  .NET, .NET Standard
Calendar  Iodine
DateTime  Island
NSDate  Toffee
PlatformEncoding
Encoding  .NET, .NET Standard
Charset  Iodine
Encoding  Island
NSNumber  Toffee
PlatformEvent
EventWaitHandle  .NET, .NET Standard
ReentrantLock  Iodine
EventWaitHandle  Island-Android, Island-iOS, Island-iOS Simulator-x86_64, Island-macOS-x86_64, Island-tvOS, Island-tvOS Simulator-x86_64, Island-Ubuntu, Island-watchOS, Island-watchOS Simulator, Island-Windows
NSCondition  Toffee
PlatformGuid
Guid  .NET, .NET Standard
UUID  Iodine
Guid  Island
NSUUID  Toffee
PlatformImmutableList<T>
List<T>  .NET, .NET Standard
ArrayList<T>  Iodine
List<T>  Island
NSArray<T>  Toffee
PlatformImmutableQueue<T>
Queue<T>  .NET, .NET Standard
LinkedList<T>  Iodine
Queue<T>  Island
NSArray<T>  Toffee
PlatformImmutableStack<T>
Stack<T>  .NET, .NET Standard, Iodine
Stack<T>  Island
NSArray<T>  Toffee
PlatformInternalFileStream
FileStream  .NET, .NET Standard
RandomAccessFile  Iodine
FileStream  Island-Android, Island-iOS, Island-iOS Simulator-x86_64, Island-macOS-x86_64, Island-tvOS, Island-tvOS Simulator-x86_64, Island-Ubuntu, Island-watchOS, Island-watchOS Simulator, Island-Windows
NSFileHandle  Toffee
PlatformList<T>
List<T>  .NET, .NET Standard
ArrayList<T>  Iodine
List<T>  Island
NSMutableArray<T>  Toffee
PlatformMath
Math  .NET, .NET Standard, Iodine
Math  Island
PlatformMemoryStream
MemoryStream  .NET, .NET Standard
ByteArrayOutputStream  Iodine
MemoryStream  Island
NSMutableData  Toffee
PlatformMethod
MethodInfo  .NET, .NET Standard
Method  Iodine
MethodInfo  Island
PlatformMonitor
ManualResetEvent  .NET, .NET Standard
ReentrantLock  Iodine
Monitor  Island
NSRecursiveLock  Toffee
PlatformParameter
ParameterInfo  .NET, .NET Standard
ArgumentInfo  Island
PlatformProcess
Process  .NET, .NET Standard
Process  Island-macOS-x86_64, Island-Windows
NSTask  Toffee-macOS
PlatformProperty
PropertyInfo  .NET, .NET Standard
PropertyInfo  Island
PlatformQueue<T>
Queue<T>  .NET, .NET Standard
LinkedList<T>  Iodine
Queue<T>  Island
NSMutableArray<T>  Toffee
PlatformSeekOrigin
SeekOrigin  .NET, .NET Standard
SeekOrigin  Island
PlatformStack<T>
Stack<T>  .NET, .NET Standard, Iodine
Stack<T>  Island
NSMutableArray<T>  Toffee
PlatformStream
Stream  .NET, .NET Standard
Stream  Island
PlatformString
String  .NET, .NET Standard, Iodine
String  Island
NSString  Toffee
PlatformThread
Thread  .NET, .NET Standard, Iodine
Thread  Island-Android, Island-iOS, Island-iOS Simulator-x86_64, Island-macOS-x86_64, Island-tvOS, Island-tvOS Simulator-x86_64, Island-Ubuntu, Island-watchOS, Island-watchOS Simulator, Island-Windows
NSThread  Toffee
PlatformTimer
Timer  .NET, .NET Standard, Iodine
Timer  Island
NSTimer  Toffee
PlatformTimeZone
TimeZoneInfo  .NET, .NET Standard
TimeZone  Iodine
TimeZone  Island
NSTimeZone  Toffee
PlatformType
Type  .NET, .NET Standard
Class  Iodine, Toffee
Type  Island
RegistryHive
Microsoft.Win32.RegistryHive  .NET
String  Island-Windows
StringDictionary
Dictionary<String, String>
StringDictionary2
Dictionary<String, Dictionary<String, String>>
StringDictionary3
Dictionary<String, Dictionary<String, Dictionary<String, String>>>
StringDictionary4
Dictionary<String, Dictionary<String, Dictionary<String, Dictionary<String, String>>>>

How Elements RTL Works

A large portion of Elements RTL is implemented using an Elements compiler feature called Mapped Types that allows platform-native classes to be accessed using a different, shared API defined by Elements RTL.

For example, RemObjects.Elements.RTL.Dictionary is the class Elements RTL provides for working with a dictionary of keys and values. The class, and its methods, can be used on .NET, Cocoa, Java and Island in exactly the same way, so code that makes use of a RemObjects.Elements.RTL.Dictionary can be compiled for all platforms. But it is not a "real" class. Instead, it is a mapping to

That means that when your code is using RemObjects.Elements.RTL.Dictionary on, say, Cocoa, the compiler will actually translate it to code that directly works with an NSMutableDictionary. The same code, compiled for Java, will seamlessly use a HashMap.

This has several benefits:

  • Rather than "reinventing the wheel", Elements RTL makes use of existing (and well-tested) classes and APIs provided by the underlying frameworks.
  • Elements RTL never boxes you in; you can always access features of the underlying framework classes, simply by casting (although of course that part of the code then becomes platform dependent).
  • Casting between Elements RTL and framework classes is toll free, so your platform-specific UI code can be written to use the regular framework classes, but can seamlessly pass those into your shared business code, which expects and works with Elements RTL classes.

Contributing

Elements RTL is open source and available on GitHub. It also ships pre-compiled and pre-installed with Elements 9.1 and later. Contributions are welcome.

The bulk part of Elements RTL is written in the Oxygene language, but you can open the Elements RTL projects in Fire and Visual Studio 2017 without requiring an Oxygene license, so even C#, Swift or Iodine developers can contribute. We accept contributions in any of the four Elements languages.

See Also