Add support for iOS 10 async operation
Mazyod opened this issue · comments
iOS 10 adds a way to asynchronously try opening an applications, and registering a callback once that's over:
open func open(_ url: URL, options: [String : Any] = [:], completionHandler completion: (@escaping (Bool) -> Swift.Void)? = nil)
We can probably provide a new method that conditionally compiles if the minimum SDK requirement is iOS 10.
Ok deal I will try to do it ASAP. Can I take your opinion? I think we can solve it as mentioned here:
http://useyourloaf.com/blog/openurl-deprecated-in-ios10/
func open(scheme: String) {
if let url = URL(string: scheme) {
if #available(iOS 10, *) {
UIApplication.shared.open(url, options: [:],
completionHandler: {
(success) in
print("Open \(scheme): \(success)")
})
} else {
let success = UIApplication.shared.openURL(url)
print("Open \(scheme): \(success)")
}
}
}
// Typical usage
open(scheme: "tweetbot://timeline")
Hmm, this is not ideal.
We should allow users to pass in a completion handler
--
Maz Jaleel ✌️
iOS Engineer, Game Developer, Python hacker
On September 21, 2016 at 11:00:24 AM, Mariam AlJamea (notifications@github.com) wrote:
Ok deal I will try to do it ASAP. Can I take your opinion? I think we can solve it as mentioned here:
http://useyourloaf.com/blog/openurl-deprecated-in-ios10/
`func open(scheme: String) {
if let url = URL(string: scheme) {
if #available(iOS 10, *) {
UIApplication.shared.open(url, options: [:],
completionHandler: {
(success) in
print("Open (scheme): (success)")
})
} else {
let success = UIApplication.shared.openURL(url)
print("Open (scheme): (success)")
}
}
}
// Typical usage
open(scheme: "tweetbot://timeline")`
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
I will try with it to find a perfect solution.
Sent from my iPhone
On Sep 21, 2016, at 11:01 AM, Maz Jaleel notifications@github.com wrote:
Hmm, this is not ideal.
We should allow users to pass in a completion handlerMaz Jaleel ✌️
iOS Engineer, Game Developer, Python hackerOn September 21, 2016 at 11:00:24 AM, Mariam AlJamea (notifications@github.com) wrote:
Ok deal I will try to do it ASAP. Can I take your opinion? I think we can solve it as mentioned here:
http://useyourloaf.com/blog/openurl-deprecated-in-ios10/`func open(scheme: String) {
if let url = URL(string: scheme) {
if #available(iOS 10, *) {
UIApplication.shared.open(url, options: [:],
completionHandler: {
(success) in
print("Open (scheme): (success)")
})
} else {
let success = UIApplication.shared.openURL(url)
print("Open (scheme): (success)")
}
}
}// Typical usage
open(scheme: "tweetbot://timeline")`—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.