2

The question is as simple as:

Can an Apple Watch app have multiple glances?

I tried to put multiple glances in the Xcode storyboard but Xcode said that only one Glance is allowed for each app.

Reason I am asking this is that I would like to change the layout of the Glance based on the information I display.


But the question could also be phrased as:

Is it possible to

  • change the glance layout programmatically or
  • load different glances depending on the context.

Is any of the two possible? And if not, is there any indication that this may change after WWDC 2015?


EDIT:

To clarify. I agree, multiple glances seem not to be available, however changing layout of a glance may be (I personally think that they will allow developers to do so soon but as far we are concerned at the moment the only way I can change a glance layout is to choose it from the list provided in XCode).

Currently these are the layouts available for glances (top and bottom part). Ideally I'd like to choose them programmatically. If anyone knows how then please share some code snippet/sample:

Top part:

enter image description here

Bottom part:

enter image description here

mm24
  • 9,280
  • 12
  • 75
  • 170

2 Answers2

1

The answer is as simple as:

No.


  • I'm not sure about changing it programmatically (haven't tried)
  • I don't think that you can load different glances.

The point of glances is to allow users to find one piece of info ultra quickly. For that, they need to know what they will be looking at. That's why there is only one glance per app.

Quentin Hayot
  • 7,786
  • 6
  • 45
  • 62
1

An app can have 1 glance associated with it. However it can be modified from time to time as per your requirement.

awakeWithContext() is called once for the controller. You can do general init work there.

willActivate() will be called everytime the glance controller is about to be initialised and you can request new data, change view there, do other awesome work, etc.

So to answer your question, you can load different glances depending on the context. But an app can have only ONE glance at a time.

Hope this helped.

sudhanshu-shishodia
  • 1,100
  • 1
  • 11
  • 25
  • Can you actually change the layout of the upper and lower part of the glance in awakeWithContext or willActivate? Do you have some code snippet? – mm24 Jun 03 '15 at 09:10
  • You cannot change the frames programatically as with iPhone app, but you can modify layout using` isHidden/setHidden` for the view you want to hide. – sudhanshu-shishodia Jun 03 '15 at 09:12
  • This does not modify it. Will simply hide elements in the layout (E.g. setHidden to a Group). I would want to be able to add a group or modify the layout. Please see my edit. – mm24 Jun 03 '15 at 09:14
  • You can only have one glance, and the template for that glance can only be set in interface builder. At run-time, the only way to modify the arrangement of items is to show/hide elements that you already added using interface builder. That's the whole story. – Mike Swanson Jun 03 '15 at 17:15
  • @MikeSwanson yep, that's what I thought as well.. however lets see what happens in WWDC '15 next week. I think/hope they will add the capability of changing the glance layout (properly) programmatically. – mm24 Jun 03 '15 at 23:50