Last active
March 31, 2017 11:22
-
-
Save AndreyPanov/2fe3b604d4a49603e6727ba16d19b818 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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