Skip to content

Instantly share code, notes, and snippets.

@SURYAKANTSHARMA
Last active May 6, 2019 14:44
Show Gist options
  • Save SURYAKANTSHARMA/7ac00b319896d5a28a0f03bccd7c913c to your computer and use it in GitHub Desktop.
Save SURYAKANTSHARMA/7ac00b319896d5a28a0f03bccd7c913c to your computer and use it in GitHub Desktop.
strongCouple
struct Document {
let identifier: Int
}
enum Mode: String {
case edit = "edit"
case view = "view"
}
class DocumentOpener {
func openUrl(document: Document, mode: Mode) {
let stringURL = "myappscheme://open?id=\(document.identifier)&mode=\(mode.rawValue)"
guard let url = URL(string: stringURL) else {
return
}
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment