Skip to content

Instantly share code, notes, and snippets.

@AndreyPanov
Last active March 31, 2017 11:22
Show Gist options
  • Save AndreyPanov/2fe3b604d4a49603e6727ba16d19b818 to your computer and use it in GitHub Desktop.
Save AndreyPanov/2fe3b604d4a49603e6727ba16d19b818 to your computer and use it in GitHub Desktop.
struct DeepLinkURLConstants {
static let Onboarding = "onboarding"
static let Items = "items"
static let Item = "item"
static let Settings = "settings"
}
enum DeepLinkOption {
case onboarding
case items
case settings
case item(String?)
static func build(with id: String, params: [String : AnyObject]?) -> DeepLinkOption? {
let itemID = params?["item_id"] as? String
switch id {
case DeepLinkURLConstants.Onboarding: return .onboarding
case DeepLinkURLConstants.Items: return .items
case DeepLinkURLConstants.Item: return .item(itemID)
case DeepLinkURLConstants.Settings: return .settings
default: return nil
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment