Skip to content

Instantly share code, notes, and snippets.

@opsb
Created May 25, 2020 18:39
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 opsb/0081ce0a211b3f88e6510eafa4ba2198 to your computer and use it in GitHub Desktop.
Save opsb/0081ce0a211b3f88e6510eafa4ba2198 to your computer and use it in GitHub Desktop.
Map operation on a protocol in swift
public protocol Notifier {
associatedtype Event
init()
func send(_ : Event) -> Void
func map<ChildNotifier, ChildEvent>(_ : (Event) -> (ChildEvent)) -> ChildNotifier where ChildNotifier : Notifier, ChildNotifier.Event == ChildEvent
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment