Skip to content

UIWindowScene: traitCollection property ​

The traitCollection property is the appearance traits of the whole scene. To find out whether Settings is currently set to dark or light, read its userInterfaceStyle.

Value ​

A UITraitCollection.

Examples ​

js
application.addEventListener('sceneconnect', (e) => {
  console.log(e.scene.traitCollection.userInterfaceStyle);
});

Result: logs whether the system is currently light or dark, such as light.

Corresponding iOS API ​

UIWindowScene.traitCollection.

See also ​