Skip to content

Instantly share code, notes, and snippets.

@sritchie
Created June 6, 2014 14:03
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 sritchie/f876c290099ae05722c8 to your computer and use it in GitHub Desktop.
Save sritchie/f876c290099ae05722c8 to your computer and use it in GitHub Desktop.
Injection
import Cocoa
let x = "Face"
protocol Injection<T, U> {
func apply(T) -> U
func invert(U) -> T?
}
class IntInjection: Injection {
func apply(i: Int) -> String {
String(i)
}
func invert(s: String) -> Int? {
s.toInt()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment