init(elementCode:properties:data:)
Returns an instance of an SBObject subclass initialized with the specified properties and data and added to the designated element array.
Declaration
init(elementCode code: DescType, properties: [String : Any]?, data: Any?)Parameters
- code:
A four-character code used to identify an element in the target application’s scripting interface. See Apple_event_manager for details.
- properties:
A dictionary with Nsnumber keys specifying the four-character codes of properties (that is, attributes or to-one relationships) and the values for those properties. Pass
nilif you are initializing the object bydataonly. - data:
An object containing data for the new
SBObjectobject. The data varies according to the type of scripting object to be created. Passnilif you initializing the object bypropertiesonly.
Return Value
An SBObject object or nil if the object could not be initialized.
Discussion
Unlike the other initializers of this class, this method not only initializes the SBObject object but adds it to a specified element array. This method is the designated initializer.