title: SwiftUI Screen safe area
body: <p>Im trying to calculate the screen safe area size in a SwiftUI app launch so I can derive component sizes from the safe area rectangle for iOS devices of different screen sizes.</p>
  <p>UIScreen.main.bounds - I can use this at the start but it gives me the total screen and not the safe area</p>
  <p>GeometryReader - using this I can get the CGSize of the safe area but I cant find a way to send this anywhere - tried using Notifications and simple functions both of which caused errors</p>
  <p>Finally I tried using the .onPreferenceSet event in the initial view then within that closure set a CGSize variable in a reference file, but doing that, for some reason makes the first view  initialise twice. Does anyone know a good way to get the edge insets or the safe area size at app startup?</p>