Skip to content

Instantly share code, notes, and snippets.

@Oni-zerone
Last active December 11, 2018 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Oni-zerone/08c250b3a97bf15ee2e6d3b1fb55725f to your computer and use it in GitHub Desktop.
Save Oni-zerone/08c250b3a97bf15ee2e6d3b1fb55725f to your computer and use it in GitHub Desktop.
The InteractionDelegate bridge to AbstractFactory
public typealias InteractionFactory = InteractionDelegate & AbstractFactory
public extension InteractionDelegate where Self: AbstractFactory {
func containerView(_ containerView: UIView, shouldSelect item: ItemViewModel) -> Bool {
return item is BuilderContainer
}
func containerView(_ containerView: UIView, didSelect item: ItemViewModel) {
guard let builderContainer = item as? BuilderContainer,
let builder = self.getBuilder(from: container),
let viewController = self.make(from: builder) else {
return
}
self.presenterViewController?.show(viewController, sender: sender)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment