WasimSafdar WasimSafdar - 21 days ago 14
Swift Question

'shared' is unavailable use view controller based solutions where appropriate instead Swift 3

I am trying to add 1 library in to my code but after adding framework using pod install and converting the code to Swift 3, I am getting the above mentioned error here.

public override init() {
size = UIApplication.shared.delegate!.window!!.bounds.size //Error here

Thanks for your suggestions.


If you only want the main screen's bounds you can get them by using the following code.

let mainScreenSize = UIScreen.main.bounds.size