Executes custom code using the traits of the current trait collection.
- iOS 13.0+
- Mac Catalyst 13.0+
- tvOS 13.0+
A block containing the code you want to execute. This block has no return value and takes no parameters.
Use this method when you want to execute code using a set of traits that differ from those in the current trait environment. For example, you might use this method to draw part of a view's content with a different set of traits. This method temporarily replaces the traits of the current environment with the ones found in the current
UITrait. After the
actions block finishes, the method restores the original traits to the environment.
You can call this method from any thread of your app.