Closed BhaktiKarva closed 7 years ago
Can I call UIApplication.shared
on your project.
If it can not be called, there is a possibility that it is not swift3.0
I checked and I cannot call UIApplication.shared
. Actually I am using this in a custom-keyboard extension and not in the main app. Is that why I am facing this issue?
How can I change it to use in the keyboard extension. any help would be greatly appreciated.
Access a sharedApplication object, and so cannot use any of the methods on that object
You may be able to build it if you delete the code below
open func showAsDialog(_ contentView: UIView) {
guard let rootView = UIApplication.shared.windows.last ?? UIApplication.shared.keyWindow else {
return
}
self.showAsDialog(contentView, inView: rootView)
}
open func show(_ contentView: UIView, fromView: UIView) {
guard let rootView = UIApplication.shared.windows.last ?? UIApplication.shared.keyWindow else {
return
}
self.show(contentView, fromView: fromView, inView: rootView)
}
But will it work as expected?
Internally it gets the key window and just calls the following
func show(_ contentView: UIView, fromView: UIView, inView: UIView)
So i can call this function instead of show(_ contentView: UIView, fromView: UIView) to show the popup?
It works 👍 Thank you so much :)
very good! It may correspond in the future for app extension.
Helo, I just installed version 1.0.4 because I am using Swift 3.0 I tried to build the project but it gives me error in the Popover.swift file at - self.showAsDialog(contentView, inView: UIApplication.shared.keyWindow!) error - 'shared' is unavailable. Use view controller based solutions where appropriate instead.
Please help.