Last active
May 6, 2019 14:44
-
-
Save SURYAKANTSHARMA/7ac00b319896d5a28a0f03bccd7c913c to your computer and use it in GitHub Desktop.
strongCouple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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