pushTemplate(_:animated:completion:)
Adds the specified template to the navigation hierarchy and displays it.
Declaration
func pushTemplate(_ templateToPush: CPTemplate, animated: Bool, completion: ((Bool, (any Error)?) -> Void)? = nil)func pushTemplate(_ templateToPush: CPTemplate, animated: Bool) async throws -> BoolParameters
- templateToPush:
The template to add to the navigation hierarchy.
- animated:
If True, CarPlay animates the transition between templates.
- completion:
The closure CarPlay calls after it adds the template.
Discussion
The template you add becomes the topTemplate in the navigation hierarchy.
CarPlay calls completion after it adds the template to the navigation hierarchy. The Boolean parameter is true when CarPlay adds the template successfully; otherwise, it’s false and CarPlay provides an error that describes the failure.
CarPlay throws an exception if it can’t add the template and you don’t provide a closure.