-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider App Extension environment #23
base: master
Are you sure you want to change the base?
Conversation
Hm. My main concern here would be not passing review. I just tested it and in an app extension it does respond to From
From the extension's view controller:
It's unclear to me what that Possibly we can add an initializer to init(window: UIWindow?) {
...
}
override convenience init() {
init(window: RxKeyboard.applicationWindow())
} Then extensions can initialize their own |
Did a bit more testing and it seems like the interactive frame changes don't work from a share extension, so there's definitely something weird with those windows. |
@ianyh, oh I just tested with Today extension and there was no window. 🤔 I think the best option is not to include RxKeyboard to extension target but I'll dig into this more. |
I expect today extensions are hosted differently than share extensions are. Share extensions are hosted by an application's process, so there would be different dynamics. Just not including the library doesn't really make sense. It's the correct behavior for what I want to be doing, so if I don't include the library I'm just going to end up writing something myself that's going to turn out the same. Seems silly. |
@ianyh, I've added some new commits! Now // ShareViewController.swift
RxKeyboard.instance.gestureView = self.view // add this line
RxKeyboard.instance.visibleHeight.drive(...) I also added a ShareExtension example. Check this out for working example :) |
This still triggers the |
@ianyh, which are you worrying about? (1) using |
I'm worried about both, but accessing it is probably worse. |
@ianyh, Hmm, I think this is not a private API so apple won't reject it but I'm not sure 🤔 |
@ianyh, MBProgressHUD uses this method too and there's no any open issue about the apple review. |
cbccdeb
to
f09e17e
Compare
Another workaround for #22, which does not make subspec.
UIApplication.shared
is unavailable on AppExtension environment. UseSelector
to get the first window of UIApplication's shared instance. There will be no window if the application is running on AppExtension.