findEntity(named:)
Recursively searches all descendant entities for one with the given name.
Declaration
@MainActor @preconcurrency func findEntity(named name: String) -> Entity?Parameters
- name:
The entity name for which to search.
Return Value
An entity with the given name, or nil if no entity is found.
Discussion
The findEntity(named:) method conducts a depth-first, recursive search over all of the entity’s descendants for one whose name property matches the given name. The method returns the first match. Entity names need not be unique.