I need to execute a code before the device's interface starts rotating but I can't seem to find any viable solution.
I came across UIDevice.orientationDidChangeNotification but couldn't find anything like that to be notified that an orientation change will start.
I tried creating an UIViewControllerRepresentable with a custom UIViewController that overrides func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator), but that function doesn't get invoked at all (I didn't forget to propagate it using super).
Any idea?