Closed indivisable closed 7 years ago
Ended up passing through show function:
public func show(target:UIView, completion:((CDAlertView) -> Swift.Void)? = nil) {
target.addSubview(self)
self.alignToParent(with: 0)
...
Then:
alert.show(target: self.nav1.view)
@candostdagdeviren is that a Swift 3 / iOS 10 issue? Should it be updated?
No it is a general issue when using the library in an Extension (for example iMessage extension) where UIApplication is not available. I have seen this fixed in other libraries by using a macro to check if compiling an app or extension.
http://stackoverflow.com/questions/29605094/detect-whether-run-target-is-app-extension-or-ios-app
I'll try to create a new version with more customizable for custom view use.
I was thinking, if it is going to be expandable and can be dismissed with dragging, I should add this to the window.
I'll try to create a new method to use in custom views. (It won't be a breaking change)
Lastly, if you want to jump in and make a contribution, open a PR. It would be awesome.
Duh, @indivisable you're totally right. Good point.
What is the best way to implement this without using the shared window code?
UIApplication.shared.keyWindow?.addSubview(self)