Last active
July 23, 2021 22:16
-
-
Save Rashidium/1dea69f5c20b89dbe5d3cc34ac411a8e to your computer and use it in GitHub Desktop.
DeeplinkManager
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
/// Manager for deeplinks. | |
public final class DeeplinkManager { | |
/// Application supported deeplinks. | |
private var links: [AppLinkable] | |
/// Initializes manager with supported links. | |
public init(supportedLinks links: [AppLinkable]) { | |
self.links = links | |
} | |
/// Returns linkable satisfied with the url. | |
/// - Parameter url: URL of the deeplink. | |
/// - Returns: Linkable satisfied with the url. | |
public func getLinkable(_ url: URL) -> AppLinkable? { | |
for (index, link) in links.enumerated() { | |
guard let activeLink = link.getLinkable(url) else { continue } | |
links[index] = activeLink | |
return activeLink | |
} | |
return nil | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment