I'm currently developing a CarPlay audio app and I can't figure out where and when to use MPPlayableContentManager.shared().beginUpdates()
and MPPlayableContentManager.shared().endUpdates()
.
The Apple docs say that you should wrap any updated MPContentItem with .beginUpdates()
and .endUpdates()
. When I do that nothing is updated on CarPlay. I feel like I'm calling the functions in the wrong place.
Apple docs:
If you are changing multiple items, or multiple properties of an item, you should call MPPlayableContentManager beginUpdates prior to updating MPContentItem objects and endUpdates after you have finished updating them. That way, the items will refresh on the screen all at once.
To me it sounds like I need to use .beginUpdates()
and .endUpdates()
in the response of an API request when I retrieve the data, but I'm not sure. Could someone please give an example of when to use both .beginUpdates()
and .endUpdates()
when updating content?