Cocoa

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.

In addition to the Objective-C class model used for most of the standard classic Cocoa APIS on Apple's platforms (AppKit, UIKit, and so on), Apple introduced a new object model alongside the Swift language, the "SWift ABI".

Swift APIs shipped by Apple are not compatible with the Cocoa/Objctive-C object model but use this new object model. We are in the process of implementing support for Swift ABI types (to be implemented, and to be consumed), but this is currently experimental and a work of progress – mostly due to lack of documentation from the side of Apple and.or the Swift compiler team.

Once Apple Swift reaches proper and documented ABI stability, the Darwin sub-platform might gain official 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.

Cocoa classes share a single hierarchy, rooted in Foundation.NSObject.

Life-Cycle Management

"Cocoa" object model classes use Automatic Reference Counting to keep track of their life-cycle. They will in general be freed automatically when no longer needed, however, retain cycles are a concern, as with all ARC-based systems.

Default Types

When set as Default Object Model, the following three base types come into scope to be used for Objects,, Strings and Exceptions (and for the C# object and string keywords):

  RemObjects.Elements.System.Cocoa.Object = public CocoaObject;
  RemObjects.Elements.System.Cocoa.String = public CocoaString;
  RemObjects.Elements.System.Cocoa.Exception = public CocoaException;

These again alias directly to the base types provided by the Cocoa Foundation framework:

  CocoaObject = public Foundation.NSObject;
  CocoaString = public Foundation.NSString;
  CocoaException = public Foundation.NSException;

See Also