Swift Base Library

The Swift Base Library is a small library that can be optionally used in Swift projects compiled with the Elements compiler. It provides some of the core types, classes and functions that, while not part of the Swift language spec per se, are commonly used in Swift apps (and provided in a similar Swift Base Library in Apple's implementation).

This includes types like the Swift-native array and dictionary types, and base functions like print().

The Swift Base Library ships precompiled with the Elements compiler, and new projects created with one of the RemObjects Silver project templates will automatically have a reference to it. If you are adding Swift files to a project that started out with a different language, you can add a reference to your projects via the Add References dialog in Fire or Visual Studio, where the Swift library should show automatically.

The library is called Swift.dll on .NET, libSwift.fx on Cocoa and swift.jar on Java and Android. All its content is contained in the Swift namespace, which is automatically in scope in .swift source files, but may also be specified explicitly (for example to resolve ambiguity).

While it is not their intended use, most of the types and functions exposed in the library are perfectly valid to be used from Oxygene and C#, as well. In these languages, the Swift namespace will need to be explicitly specified or added to the uses/using section.

Source Code

The Swift Base Library is open source and implemented fully in Silver. You can find the source code on GitHub, and contributions and pull requests are more than welcome.

Note that you will need the very latest compiler to rebuild the SBL, and in some cases, the git repository might even contain code that requires a later compiler than is available. Refer to the commit messages for details on this, and check out an older revision, if necessary.

Classes and Types

This library is a work in progress; all functionality presented is useable now, and it will be expanded and grown over time. Contributions on GitHub are more than welcome.

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





See Also