I'm using reloadRootPageControllers to load 4 InterfaceControllers and I need to pass a context to each, however using the code below, only the first InterfaceController in the array receives the context. How can I pass it to all 4?
let contextDictionary = ["workoutConfiguration" : workoutConfiguration, "ActivityType": selectedActivityType, "workoutManager" : workoutManager] as [String : Any]
WKInterfaceController.reloadRootPageControllers(withNames: ["WorkoutControlsInterfaceController", "MainDisplayInterfaceController", "SpeedInterfaceController", "CaloriesAndDistanceInterfaceController"],
contexts: [contextDictionary],
orientation: .horizontal,
pageIndex: 1)
You need to use an array which has the same number of contextDictionary
with withNames
array.
WKInterfaceController.reloadRootPageControllers(withNames: ["WorkoutControlsInterfaceController", "MainDisplayInterfaceController", "SpeedInterfaceController", "CaloriesAndDistanceInterfaceController"],
contexts: [contextDictionary, contextDictionary, contextDictionary, contextDictionary],
orientation: .horizontal,
pageIndex: 1)