Contents

setRootTemplate(_:animated:completion:)

Sets the root template of the navigation hierarchy.

Declaration

func setRootTemplate(_ rootTemplate: CPTemplate, animated: Bool, completion: ((Bool, (any Error)?) -> Void)? = nil)
func setRootTemplate(_ rootTemplate: CPTemplate, animated: Bool) async throws -> Bool

Parameters

  • rootTemplate:

    The template to use as the root of a new navigation hierarchy.

  • animated:

    If True, CarPlay animates the presentation of the template. CarPlay ignores this flag when there isn’t an existing navigation hierarchy to replace.

  • completion:

    The closure CarPlay calls after it presents the template.

Discussion

If you set a root template when a navigation hierarchy already exists, CarPlay replaces the entire hierarchy.

CarPlay calls completion after it presents the template. The Boolean parameter is true when the presentation succeeds; otherwise, it’s false and CarPlay provides an error that describes the failure. CarPlay throws an exception if the presentation fails and you don’t provide a closure.

See Also

Configuring the Interface Controller