On the Darwin sub-platform for Cocoa, two additional object models are (or will be) supported, in addition to native Island classes. These models are available both for classes and interfaces

  • Island – native Island objects and interfaces.
  • Cocoa – Objective-C objects (descending from Foundation.NSObject) and protocols.
  • Delphi – Delphi objects (descending from Delphi.System.TObject) and protocols.
  • COM – to work with COM interfaces
  • Swift – native Swift objects and protocols.

The Darwin sub-platform provides full support for the Objective-C class model, as needed to interact with the core Cocoa APIs from Foundation over AppKit/UIKit to more specialized frameworks provided by Apple and third parties.

All Cocoa classes descend (directly or indirectly) from Foundartion.NSObject. Classes declared in code will automatically become Cocoa classes, if they descend from a Cocoa class. For classes without an explicit ancestor, the [Cocoa] Aspect](/API/Aspects/ObjectModels) can be applied to mark a class as belonging in the Cocoa hierarchy (it will then descend from Foundation.NSObject instead of System.Object.

Once Apple Swift reaches proper and documented ABI stability, the Darwin sub-platform might also gain support for consuming and extending classes implemented in Apple's Swift dialect, and directly participating in Apple Swift's object model (Swift ABI). Swift objects will form a third class hierarchy.

Note: this is not to be confused with using the Swift language dialect provided by Silver. As with all five OOP Elements languages, classes written in Silver can be native Island classes, Objective-C Runtime classes or, optionally, Swift Runtime classes.

Swift classes share no a single class hierarchy and must not all have a common ancestor. However, the Any and AnyObject umbrella types can be used to hold any Swift object model instance, regardless of ancestry.

See Also