Contents

unregisterForTraitChanges(_:)

Tells the system to stop observing previously registered traits.

Declaration

@MainActor func unregisterForTraitChanges(_ registration: any UITraitChangeRegistration)

Parameters

  • registration:

    A token that identifies the registration, obtained from one of the trait registration method calls.

Mentioned in

Discussion

Use this method if you want the system to stop observing trait changes for a previous registration. UIKit doesn’t require you to unregister for trait changes at the end of the view lifecycle. Unregister only if you need to dynamically change which traits you observe.

See Also

Observing trait changes