<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Scripting Bridge",
  "identifier" : "/documentation/ScriptingBridge/SBObject/elementArray(withCode:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Scripting Bridge",
      "ScriptingBridge"
    ],
    "preciseIdentifier" : "c:objc(cs)SBObject(im)elementArrayWithCode:"
  },
  "title" : "elementArray(withCode:)"
}
-->

# elementArray(withCode:)

Returns an array containing every child of the receiver with the given
class-type code.

```
func elementArray(withCode code: DescType) -> SBElementArray
```

## Parameters

`code`

A four-character code that identifies a scripting class.

## Return Value

An [`SBElementArray`](/documentation/ScriptingBridge/SBElementArray) object containing every child of the
receiver whose class matches `code`.

## Discussion

`SBObject` subclasses use this method to implement application-specific
property accessor methods. You should not need to call this method directly.

> Note: This method doesn’t retrieve the value of the property. To get the
> value, call ``doc://com.apple.Scripting-Bridge/documentation/ScriptingBridge/SBObject/get()``.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)