CPVoiceControlState repeating image?

I am trying to use CPVoiceControlState and include an animated image, but for the life of me I cannot figure out what sort of image it wants. I have tried animated .gif, .png, a static image, an image sequence and none seem to animate.

Here is what I am using with an animated .png:

func showLoadingTemplate() {
    
    enum VoiceControlStates: String {
        case loading = "loading"
    }

    let spinner = UIImage(named: "spinner")
    loadingTemplate = CPVoiceControlTemplate(voiceControlStates: [
        CPVoiceControlState(identifier: VoiceControlStates.loading.rawValue, titleVariants: [NSLocalizedString("Loading...", comment: "CarPlay: Loading")], image: spinner, repeats: true)
    ])
    loadingTemplate?.activateVoiceControlState(withIdentifier: VoiceControlStates.loading.rawValue)

    if let loading = loadingTemplate {
        
        currentInterfaceController?.presentTemplate(loading, animated: true, completion: { (result: Bool, error: Error?) in
            
        })
        
    }
    
}

This shows the image but it isn't animating.

Can anyone let me know what sort of image needs to be used in order to get it to animate? I have seen animated images working in Waze and Google Maps so if must be possible.

Answered by Frameworks Engineer in 803309022

Hi, an animated UIImage is the way to go. There are some constraints that the system will enforce: a maximum image size of 150 points, a minimum duration per image of 0.3 seconds, and a maximum duration per image of 5 seconds. You should also ensure that -[UIImage images], the animated image accessor, returns a non-nil array of images for your specified image asset.

Hi, an animated UIImage is the way to go. There are some constraints that the system will enforce: a maximum image size of 150 points, a minimum duration per image of 0.3 seconds, and a maximum duration per image of 5 seconds. You should also ensure that -[UIImage images], the animated image accessor, returns a non-nil array of images for your specified image asset.

CPVoiceControlState repeating image?
 
 
Q