0

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)
0

1 Answer 1

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)
Sign up to request clarification or add additional context in comments.

1 Comment

Never would have guessed that one! 👍

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.