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, Water or Visual Studio, where the Swift library should show automatically.

The library is called Swift.dll on .NET, libSwift.fx on Cocoa, swift.jar on Java and Android and swift.fx on Island. 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, C# and Java, as well. In these languages, the Swift namespace will need to be explicitly specified or added to the uses/using/import 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.

Classes

Structs

Interfaces

Enums

Aliases

  • Actor
    • IActor  .NET, .NET Standard 2.0, Island, Toffee
    • IActor  Cooper
  • AnsiChar = Byte  .NET, .NET Standard 2.0, Cooper
  • Any
    • dynamic  .NET, .NET Standard 2.0, Cooper, Island
    • id  Toffee
  • AnyClass
    • Type  .NET, .NET Standard 2.0
    • Class  Toffee
  • AnyClass<T> = Class<T>  Cooper
  • AnyObject
    • dynamic  .NET, .NET Standard 2.0, Cooper, Island
    • id  Toffee
  • ArrayLiteralConvertible<Element> = Swift.IExpressibleByArrayLiteral<Element>
  • Bool = Boolean
  • BooleanLiteralConvertible<BooleanLiteralType> = Swift.IExpressibleByBooleanLiteral<BooleanLiteralType>
  • BooleanLiteralType = Boolean
  • CBool = Boolean
  • CChar = SByte
  • CChar16
    • UInt16  .NET, .NET Standard 2.0, Island, Toffee
    • Word  Cooper
  • CChar32
    • UInt32  .NET, .NET Standard 2.0, Island, Toffee
    • Cardinal  Cooper
  • CDouble = Double
  • CFloat = Single
  • CInt
    • Int32  .NET, .NET Standard 2.0, Island, Toffee
    • Integer  Cooper
  • CLong
    • Int64  .NET, .NET Standard 2.0, Cooper, Island-Android-arm64-v8a, Island-Android-x86_64, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu-aarch64, Island-Ubuntu-x86_64, Island-watchOS Simulator, Island-Windows-arm64, Island-Windows-x86_64, Toffee-iOS, Toffee-iOS Simulator, Toffee-Mac Catalyst, Toffee-macOS, Toffee-tvOS, Toffee-tvOS Simulator, Toffee-watchOS Simulator
    • Int32  Island-Android-armeabi, Island-Android-armeabi-v7a, Island-Android-x86, Island-Ubuntu-armv6, Island-watchOS, Island-WebAssembly-wasm32, Island-Windows-i386, Toffee-watchOS
  • CLongLong = Int64
  • CollectionOfOne.Distance<Element> = Int64  Cooper
  • CollectionOfOne.Index<Element> = Bit  Cooper
  • CollectionOfOne<Element>.Distance<Element>
    • Int64  .NET, .NET Standard 2.0, Island-Android-arm64-v8a, Island-Android-x86_64, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu-aarch64, Island-Ubuntu-x86_64, Island-watchOS Simulator, Island-Windows-arm64, Island-Windows-x86_64
    • Int32  Island-Android-armeabi, Island-Android-armeabi-v7a, Island-Android-x86, Island-Ubuntu-armv6, Island-watchOS, Island-WebAssembly-wasm32, Island-Windows-i386
    • Int8  Toffee
  • CollectionOfOne<Element>.Index<Element>
    • Bit  .NET, .NET Standard 2.0, Island
    • Int8  Toffee
  • CShort
    • Int16  .NET, .NET Standard 2.0, Island, Toffee
    • SmallInt  Cooper
  • CSignedChar = SByte
  • CUnsignedChar = Byte
  • CUnsignedInt
    • UInt32  .NET, .NET Standard 2.0, Island, Toffee
    • Cardinal  Cooper
  • CUnsignedLong
    • UInt64  .NET, .NET Standard 2.0, Cooper, Island-Android-arm64-v8a, Island-Android-x86_64, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu-aarch64, Island-Ubuntu-x86_64, Island-watchOS Simulator, Island-Windows-arm64, Island-Windows-x86_64, Toffee-iOS, Toffee-iOS Simulator, Toffee-Mac Catalyst, Toffee-macOS, Toffee-tvOS, Toffee-tvOS Simulator, Toffee-watchOS Simulator
    • UInt32  Island-Android-armeabi, Island-Android-armeabi-v7a, Island-Android-x86, Island-Ubuntu-armv6, Island-watchOS, Island-WebAssembly-wasm32, Island-Windows-i386, Toffee-watchOS
  • CUnsignedLongLong = UInt64
  • CUnsignedShort
    • UInt16  .NET, .NET Standard 2.0, Island, Toffee
    • Word  Cooper
  • CustomDebugStringConvertible = ICustomDebugStringConvertible
  • CustomStringConvertible = ICustomStringConvertible
  • CWideChar
    • UInt32  .NET, .NET Standard 2.0, Island, Toffee
    • Cardinal  Cooper
  • DictionaryLiteralConvertible<Key,Value> = Swift.IExpressibleByDictionaryLiteral<Key,Value>
  • Error
  • ErrorType = IErrorType
  • ExpressibleByArrayLiteral<Element> = Swift.IExpressibleByArrayLiteral<Element>
  • ExpressibleByBooleanLiteral<BooleanLiteralType> = Swift.IExpressibleByBooleanLiteral<BooleanLiteralType>
  • ExpressibleByDictionaryLiteral<Key,Value> = Swift.IExpressibleByDictionaryLiteral<Key,Value>
  • ExpressibleByFloatLiteral<FloatLiteralType> = Swift.IExpressibleByFloatLiteral<FloatLiteralType>
  • ExpressibleByIntegerLiteral<IntegerLiteralType> = Swift.IExpressibleByIntegerLiteral<IntegerLiteralType>
  • ExpressibleByNilLiteral = IExpressibleByNilLiteral
  • ExpressibleByStringInterpolation<StringInterpolationType> = Swift.IExpressibleByStringInterpolation<StringInterpolationType>
  • ExpressibleByStringLiteral<StringLiteralType> = Swift.IExpressibleByStringLiteral<StringLiteralType>
  • ExpressibleByUnicodeScalarLiteral<UnicodeScalarLiteralType> = Swift.IExpressibleByUnicodeScalarLiteral<UnicodeScalarLiteralType>
  • ExtendedGraphemeClusterType
    • String  .NET, .NET Standard 2.0, Cooper, Island
    • NSString  Toffee
  • Float = Single
  • Float32 = Single
  • Float64 = Double
  • FloatLiteralConvertible<FloatLiteralType> = Swift.IExpressibleByFloatLiteral<FloatLiteralType>
  • FloatLiteralType = Double
  • Hashable = IHashable
  • IBooleanType = BooleanType
  • ICollectionType<SubSequence,Index,Distance,Element> = Swift.CollectionType<SubSequence,Index,Distance,Element>
  • Identifiable<ID>
    • IIdentifiable<ID>  Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-watchOS, Island-watchOS Simulator, Island-Windows-i386, Island-Windows-x86_64
    • IIdentifiable<ID>  Island-WebAssembly-wasm32, Island-Windows-arm64
  • IIncrementable = Incrementable
  • IIndexable<Index,Distance,Element> = Swift.Indexable<Index,Distance,Element>
  • ILazySequence<T>
  • ILazySequenceType<T>
  • INSObjectProtocol = INSObject  Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-watchOS, Island-watchOS Simulator, Toffee
  • Int
    • Int64  .NET, .NET Standard 2.0, Cooper, Island-Android-arm64-v8a, Island-Android-x86_64, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu-aarch64, Island-Ubuntu-x86_64, Island-watchOS Simulator, Island-Windows-arm64, Island-Windows-x86_64, Toffee-iOS, Toffee-iOS Simulator, Toffee-Mac Catalyst, Toffee-macOS, Toffee-tvOS, Toffee-tvOS Simulator, Toffee-watchOS Simulator
    • Int32  Island-Android-armeabi, Island-Android-armeabi-v7a, Island-Android-x86, Island-Ubuntu-armv6, Island-watchOS, Island-WebAssembly-wasm32, Island-Windows-i386, Toffee-watchOS
  • Int8 = SByte
  • IntegerLiteralConvertible<IntegerLiteralType> = Swift.IExpressibleByIntegerLiteral<IntegerLiteralType>
  • IntegerLiteralType
    • Int64  .NET, .NET Standard 2.0, Cooper, Island-Android-arm64-v8a, Island-Android-x86_64, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu-aarch64, Island-Ubuntu-x86_64, Island-watchOS Simulator, Island-Windows-arm64, Island-Windows-x86_64, Toffee-iOS, Toffee-iOS Simulator, Toffee-Mac Catalyst, Toffee-macOS, Toffee-tvOS, Toffee-tvOS Simulator, Toffee-watchOS Simulator
    • Int32  Island-Android-armeabi, Island-Android-armeabi-v7a, Island-Android-x86, Island-Ubuntu-armv6, Island-watchOS, Island-WebAssembly-wasm32, Island-Windows-i386, Toffee-watchOS
  • IntMax = Int64
  • ISequenceType<T>
    • IEnumerable<T>  .NET, .NET Standard 2.0, Island
    • Iterable<T>  Cooper
    • INSFastEnumeration  Toffee
  • LazySequenceType<T>
  • NativeString
    • String  .NET, .NET Standard 2.0, Cooper, Island
    • NSString  Toffee
  • NativeStringBuilder
    • StringBuilder  .NET, .NET Standard 2.0, Cooper
    • StringBuilder  Island
  • NilLiteralConvertible = IExpressibleByNilLiteral
  • NSObject
    • Object  .NET, .NET Standard 2.0, Cooper, Island-Android, Island-Ubuntu, Island-WebAssembly-wasm32, Island-Windows
    • NSObject  Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-watchOS, Island-watchOS Simulator, Toffee
  • NSObjectProtocol = INSObject  Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-watchOS, Island-watchOS Simulator, Toffee
  • OpaquePointer = ^void  .NET, .NET Standard 2.0, Island, Toffee
  • OutputStreamType = IOutputStreamType
  • PlatformDictionary<T,U>
    • not nullable Dictionary<T, U>  .NET, .NET Standard 2.0
    • not nullable HashMap<T, U>  Cooper
    • not nullable RemObjects.Elements.System.Dictionary<T,U>  Island
    • not nullable NSMutableDictionary<T, U>  Toffee
  • PlatformImmutableDictionary<T,U>
    • not nullable not nullable Dictionary<T, U>  .NET, .NET Standard 2.0
    • not nullable not nullable HashMap<T, U>  Cooper
    • not nullable not nullable RemObjects.Elements.System.Dictionary<T,U>  Island
    • not nullable NSDictionary<T, U>  Toffee
  • PlatformImmutableList<T>
    • not nullable not nullable List<T>  .NET, .NET Standard 2.0
    • not nullable not nullable ArrayList<T>  Cooper
    • not nullable not nullable RemObjects.Elements.System.List<T>  Island
    • not nullable NSArray<T>  Toffee
  • PlatformList<T>
    • not nullable List<T>  .NET, .NET Standard 2.0
    • not nullable ArrayList<T>  Cooper
    • not nullable RemObjects.Elements.System.List<T>  Island
    • not nullable NSMutableArray<T>  Toffee
  • PlatformSequence<T> = not nullable IEnumerable<T>  Island
  • PlatformSet<T> = not nullable RemObjects.Elements.System.List<T>  Island
  • RawRepresentable<RawValue> = Swift.IRawRepresentable<RawValue>
  • Selector = SEL  Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-watchOS, Island-watchOS Simulator, Toffee
  • Sendable
    • ISendable  .NET, .NET Standard 2.0, Island, Toffee
    • ISendable  Cooper
  • SequenceType<T>
  • Set<T>.Element<T> = T  Island
  • SignedIntegerType = ISignedIntegerType
  • SignedNumberType<IntegerLiteralType> = Swift.ISignedNumberType<IntegerLiteralType>
  • Sliceable<SubSlice,SubSequence,Index,Distance,Element> = Swift.ISliceable<SubSlice,SubSequence,Index,Distance,Element>
  • StaticString
    • String  .NET, .NET Standard 2.0, Cooper, Island
    • NSString  Toffee
  • Streamable = IStreamable
  • StringInterpolationConvertible<StringInterpolationType> = Swift.IExpressibleByStringInterpolation<StringInterpolationType>
  • StringLiteralConvertible<StringLiteralType> = Swift.IExpressibleByStringLiteral<StringLiteralType>
  • StringLiteralType
    • String  .NET, .NET Standard 2.0, Cooper, Island
    • NSString  Toffee
  • StringProtocol = IStringProtocol
  • SwiftString.UnicodeScalarView
    • UTF32View  .NET, .NET Standard 2.0, Cooper, Island
    • Int8  Toffee
  • TextOutputStream = ITextOutputStream
  • TextOutputStreamable = ITextOutputStreamable
  • UInt
    • UInt64  .NET, .NET Standard 2.0, Cooper, Island-Android-arm64-v8a, Island-Android-x86_64, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu-aarch64, Island-Ubuntu-x86_64, Island-watchOS Simulator, Island-Windows-arm64, Island-Windows-x86_64, Toffee-iOS, Toffee-iOS Simulator, Toffee-Mac Catalyst, Toffee-macOS, Toffee-tvOS, Toffee-tvOS Simulator, Toffee-watchOS Simulator
    • UInt32  Island-Android-armeabi, Island-Android-armeabi-v7a, Island-Android-x86, Island-Ubuntu-armv6, Island-watchOS, Island-WebAssembly-wasm32, Island-Windows-i386, Toffee-watchOS
  • UInt8 = Byte
  • UIntMax = UInt64
  • UnicodeScalar
    • UInt32  .NET, .NET Standard 2.0, Island, Toffee
    • Cardinal  Cooper
  • UnicodeScalarLiteralConvertible<UnicodeScalarLiteralType> = Swift.IExpressibleByUnicodeScalarLiteral<UnicodeScalarLiteralType>
  • UnicodeScalarType
    • String  .NET, .NET Standard 2.0, Cooper, Island
    • NSString  Toffee
  • UnsafeBufferPointer<T> = ^T  .NET, .NET Standard 2.0, Island, Toffee
  • UnsafeMutableBufferPointer<T> = ^T  .NET, .NET Standard 2.0, Island, Toffee
  • UnsafeMutableRawBufferPointer = ^void  .NET, .NET Standard 2.0, Island, Toffee
  • UnsafeMutableRawPointer = ^void  .NET, .NET Standard 2.0, Island, Toffee
  • UnsafeRawBufferPointer = ^void  .NET, .NET Standard 2.0, Island, Toffee
  • UnsafeRawPointer = ^void  .NET, .NET Standard 2.0, Island, Toffee
  • UnsignedIntegerType = IUnsignedIntegerType
  • UTF16Char = Char
  • UTF32Char
    • UInt32  .NET, .NET Standard 2.0, Island, Toffee
    • Cardinal  Cooper
  • UTF8Char = Byte
  • UWord
    • UInt16  .NET, .NET Standard 2.0, Island, Toffee
    • Word  Cooper
  • Word
    • Int64  .NET, .NET Standard 2.0, Cooper, Island-Android-arm64-v8a, Island-Android-x86_64, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu-aarch64, Island-Ubuntu-x86_64, Island-watchOS Simulator, Island-Windows-arm64, Island-Windows-x86_64, Toffee-iOS, Toffee-iOS Simulator, Toffee-Mac Catalyst, Toffee-macOS, Toffee-tvOS, Toffee-tvOS Simulator, Toffee-watchOS Simulator
    • Int32  Island-Android-armeabi, Island-Android-armeabi-v7a, Island-Android-x86, Island-Ubuntu-armv6, Island-watchOS, Island-WebAssembly-wasm32, Island-Windows-i386, Toffee-watchOS

See Also