How to change the window title in a Mac Catalyst window scene?

I'm opening multiple scenes in the Mac Catalyst version of my iPad app. The problem is that all of the windows simply show my app name in each window title. This makes it confusing looking at the list of windows in the Window menu. Plus I want to specific information to appear in the window title beside the app name.


UIWindowScene has a promising Mac Catalyst-only property named

titleBar
of type
UITitleBar
. Sounds promising but it has nothing related to setting any kind of title. Strange.


There's nothing I can find in the

UIScene
or
UIWindow
classes or anything related to scenes.


Is there any way to set a window's title in a Mac Catalyst app?

Accepted Reply

I don't know how I missed it but it turns out this is trivial.


The

UIScene
class has a
title
property which is exactly what is needed. The value of this property is what is shown in the iPad app switcher as well as in the title bar of the iPad app running on a Mac.


Setting it to nil defaults to the app name. Setting it to the empty string shows no title. And of course setting it to any other value shows that title.

Replies

I don't know how I missed it but it turns out this is trivial.


The

UIScene
class has a
title
property which is exactly what is needed. The value of this property is what is shown in the iPad app switcher as well as in the title bar of the iPad app running on a Mac.


Setting it to nil defaults to the app name. Setting it to the empty string shows no title. And of course setting it to any other value shows that title.