How to set UIScreen.main.brightness in SwiftUI

I have a current app in the store written in Objective C that works OK, but I want to update it via SwiftUI as a universal app.

In my original app, I adjust the display brightness for night time use by setting UIScreen.main.brightness = 0.2 for example. When exiting the application, I return it to its previous value.

I have been unable to find out how this can be done in SwiftUI.

Anyone know?