Set accessibility text size from within app

I wonder if it is possible to modify my application's accessibility text size from within the app, similar to setting the brightness with UIScreen.main.brightness = myBrightness.

I've attempted setting .dynamicTypeSize(…) on my main view, but that setting does not get propagated when displaying sheets or popovers.