Skip to content

Instantly share code, notes, and snippets.

@candostdagdeviren
Created December 3, 2018 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save candostdagdeviren/0ff1f47d5c8ef7c7547c0d3e8b6e5bf6 to your computer and use it in GitHub Desktop.
Save candostdagdeviren/0ff1f47d5c8ef7c7547c0d3e8b6e5bf6 to your computer and use it in GitHub Desktop.
Swift Post Testability Example Code
class FileOpener {
func open(identifier: String) {
guard let url = URL(string: "iosappscheme://open?id=\(identifier)") else {
debugPrint("Failed to convert URL")
return
}
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
} else {
debugPrint("Failed to open URL")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment