I can get the status bar from UIApplication in normal app by
[UIApplication sharedApplication].statusBarFrame
But we cannot access UIApplication from Extension.Is there a way to find get the statusbar in share?
I can get the status bar from UIApplication in normal app by
[UIApplication sharedApplication].statusBarFrame
But we cannot access UIApplication from Extension.Is there a way to find get the statusbar in share?
 
    
    You may use safeAreaLayoutGuide to calculate layout frame. eg,
viewController.view.safeAreaLayoutGuide.layoutFrame.minY
 
    
    Alternate Option:
If you're using a view controller with NavigationBar, you can consider its y position as the StatusBar height, in case safeAreaLayoutGuide and window?.windowScene?.statusBarManager?.statusBarFrame.height options were not available or usable.
let statusBarHeight = navigationController?.navigationBar.frame.origin.y ?? 0
