Customise title in the WK Status Bar

313 views Asked by At

I'm trying to customise title in the WK Status Bar of my first Controller.

enter image description here

The correct way should be this:

public func setTitle(title: String?) // title of controller. displayed when controller active

so

WKInterfaceController.setTitle("my Title")

but using this code, xCode says Cannot convert value of type 'String' to expected argument type 'WKInterfaceController'. What's wrong?

1

There are 1 answers

0
AudioBubble On BEST ANSWER

setTitle is an instance method, not a class method.

You need to refer to a specific instance controller to change that controller's title. Since you would generally be setting your first controller's title within its own code, you can omit self, and simply call

setTitle("my Title")