Skip to content
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

Add support for iOS 10 async operation #82

Open
Mazyod opened this issue Sep 21, 2016 · 3 comments
Open

Add support for iOS 10 async operation #82

Mazyod opened this issue Sep 21, 2016 · 3 comments
Milestone

Comments

@Mazyod
Copy link
Member

Mazyod commented Sep 21, 2016

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.

@Maryom
Copy link
Contributor

Maryom commented Sep 21, 2016

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")

@Mazyod
Copy link
Member Author

Mazyod commented Sep 21, 2016

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.

@Maryom
Copy link
Contributor

Maryom commented Sep 21, 2016

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 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.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants