wkinterfacecontroller is the main interface element use when building watchos apps, similar to the ViewController.swift file created in XCode when you create a new ios or macos project.
Questions tagged [wkinterfacecontroller]
67 questions
8
votes
3 answers
Selector not called on selecting menu item after force touch
I have this code, for responding to a menu item being tapped after a force touch:
class InterfaceController: WKInterfaceController {
override init() {
super.init()
self.addMenuItemWithItemIcon(WKMenuItemIcon.Pause, title:…

Andrew
- 7,693
- 11
- 43
- 81
7
votes
1 answer
Set rootInterfaceController in Apple Watch's "ExtensionDelegate"
I am making a Apple Watch app and I'd like to set different root view controllers, depending on an initial condition.
I cannot set the WatchKit rootInterfaceController directly though, because it is a readonly property, but by checking Apple…

marcelosalloum
- 3,481
- 4
- 39
- 63
6
votes
1 answer
WatchOS warning: rejected resignFirstResponder when being removed from hierarchy
I'm getting this error in Xcode.
2018-02-26 07:13:22.326888-0500 Watch Extension[1298:2691330] [View]
First responder warning: '; layer =
…

GarySabo
- 5,806
- 5
- 49
- 124
6
votes
3 answers
How can I disable the user interaction for the Cancel button of my watchOS interface controller?
In my Apple Watch app, one of my interface controllers has a Cancel button at the top left corner. In my case, once a particular action is completed, I don't want the user to go back to the previous screen, so I want to disable the user interaction…

simbesi.com
- 1,539
- 3
- 17
- 27
5
votes
1 answer
Strange WatchKit WKInterfaceController and WKExtensionDelegate lifecycle calls
I have added logs on both WKExtensionDelegate and WKInterfaceController.
Here is what i get when playing around with starting and exiting the app in
Watch OS Simulator. (Simulator is running watchOS 4.2)
Step 1: Upon first start of the app here are…

Dusan.czh
- 669
- 8
- 15
5
votes
2 answers
WKInterfaceTable & setNumberOfRows get crash "unexpectedly found nil while unwrapping an Optional value"
I'm working with WatchKit, I have a simple interface with only a table but I get an error with just a few lines of code, maybe I forgot something really basic.
My interface:
the row inside the table has the identifier:
and the custom class:
The…

Massimo Polimeni
- 4,826
- 4
- 27
- 54
5
votes
0 answers
Why is willActivate called twice when watch app enters foreground?
Is there a way to avoid this behavior. I update the watch app interface with new data when app enters foreground. Is that not the recommended time to do that? The view controller is the first page within a page based navigation pattern.

oviroa
- 1,079
- 2
- 12
- 29
4
votes
2 answers
Why can't I send data between interface controllers for Apple Watch?
Basically, what I'm trying to do is pass an integer from one interface controller. The slider in the controller "SecondPage" will get an integer value from the slider and should send it to the interface controller called "ThirdPage" and set the…

rowan atkinson
- 119
- 1
- 10
4
votes
1 answer
Why is WKInterfacePicker considered an undeclared type?
I'm using Xcode Version 7.0 beta 3. When attempting to use a WKInterfacePicker, I get an error.
Here is my code for my WKInterfaceController:
import WatchKit
import Foundation
class RBWelcomeVC: WKInterfaceController {
@IBOutlet var…

iOSAppGuy
- 633
- 7
- 23
3
votes
0 answers
Breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy when an alert should be shown on WKInterfaceController
My watch app uses a WKInterfaceController to display a WKInterfaceTable. In case of errors, it displays an alert using presentAlert called in the presented WKInterfaceController.
I have set a symbolic breakpoint at…

Reinhard Männer
- 14,022
- 5
- 54
- 116
3
votes
0 answers
How to inject viewModel class into WKInterfaceController?
I'm trying to inject my viewModel class to WKInterfaceController, in my InterfaceController I have set property but when I try to use it in func awake(withContext context: Any?), it's nil.
So the way I was trying to do it: setting up the container…

Sebastian Zalewski
- 131
- 1
- 8
3
votes
2 answers
How can I share variables between multiple interface controllers in a paged-based interface on watchOS
I have multiple interface controllers that are both open at the same time in a paged-based format. I need to share information between these interface controllers.
For my use case, I cannot force the user to one of the other interface controllers…

wazawoo
- 545
- 5
- 18
3
votes
3 answers
WKInterfaceTable's didSelectRowAtIndex never gets called in WKInterfaceController
I have a WKInterfaceController and I added a table as following:
// .h
@interface InterfaceController : WKInterfaceController
@property (weak, nonatomic) IBOutlet WKInterfaceTable *table;
@end
// .m
- (void)table:(WKInterfaceTable *)table…

mm24
- 9,280
- 12
- 75
- 170
2
votes
0 answers
WKInterfaceController's becomeCurrentPage not working as expected
I'm loading up 4 WKInterfaceControllers into a page based horizontal interface in watchKit. When a delegate callback fires alerting the app that the screen has been water locked, I want the watch to segue to one of the Controllers (based on a user…

GarySabo
- 5,806
- 5
- 49
- 124
2
votes
0 answers
WatchOS App: What is lifecycle of WKInterfaceController?
Anyone explain me correct way the WKInterfaceController lifecycle?
I would like to know how to use when creating an interface controller, WatchKit instantiates the class and calls its -init, -awakeWithContext, -willActivate, -didAppear,…

BuLB JoBs
- 841
- 4
- 20