Reputation: 19
I'm using swiftUI and I want the width and height of the screen.
It says .main will be depreciated. What should I replace it with? What's the new approach?
I have this code in my project
import SwiftUI
let width = UIScreen.main.bounds.width
let height = UIScreen.main.bounds.height
I declared this in a global file.
I'm using iOS 16.2 (the latest xcode & iOS)
Upvotes: 1
Views: 1301