Object Model Aspects
A variety of aspects are provided to specify the Object Model to use for classes and interfaces on Island sub-platforms that support more than one class hierarchy,
Object models are discussed in more detail, in the Object Model topic.
The aspects are only required if a class or interface does not declare an ancestor (otherwise, the object model it belongs to will be the same as that of the ancestor), and the if type should not use the default object model set for the project (which is typically "Island" for island projects, and "Cocoa" for Cocoa projects).
Specifying an aspect that conflicts with the object model of the ancestor class (e.g., descending explicitly from NSObject
, which is a Cocoa class, but applying the Island
aspect) will result in an error.
The following aspects are provided:
Island
– marks the class or interface as a native Island type.Cocoa
– marks the class or interface as an Objecive-C Runtime (Cocoa) type (Darwin only).Swift
– marks the class or interface as a Apple Swift Runtime type (Darwin only).Delphi
– marks the class or interface as a Delphi type (Island-backed platforms only only).COM
– marks interface as a COM-compatible Interface.
Similar Aspects:
objc
– Same asCocoa
and provided for Swift language compatibility.IBObject
– Same asCocoa
, but also marks the class as available for Interface Builder.
Note that different than objc
or IBObject
, the above aspects do not affect name mangling; classes marked with Cocoa
will still be name-mangled and prefixed with their namespace, according to the project settings.
Example
type
[Cocoa]
MyClass = public class
...
end;
[Cocoa]
public class MyClass
{
...
}
@Cocoa
public class MyClass {
...
}
@Cocoa
public class MyClass {
...
}
See Also
- Class and Interface Types in Oxygene
- Object Models on Island
modelOf()
System Function- Guid Aspect and
guidOf()
System Function - Default Object Model Compiler Option
- Legacy Cocoa Mode
IBObject
- Island Platform