No Replacement for deprecated TraitCollectionDidChange · Issue #19410 · dotnet/macios (original) (raw)
I was using traitcollectiondidchange to detect changes of the dark/light theme. That method has been deprecated with iOS 17
The suggested alternative by Apple is registerfortraitchanges, which can be called on objects that implement UITraitChangeObservable
(IUITraitChangeObservable
interface in C#). UIView
and UIViewController
seem to implement that interface, but this isn't reflected in the C# bindings - the method RegisterForTraitChanges doesn't exist for UIView
and UIViewController
. How can I use this new API in .NET?
Environment
.NET 8 RC2.2