Last active
November 25, 2015 04:59
-
-
Save jakecraige/945bd10d85ea401d6b70 to your computer and use it in GitHub Desktop.
Inferred typealias defined in protocol by implementing a function
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
protocol Action { | |
typealias StateType | |
func reduce(state: StateType) -> StateType | |
} | |
struct MyState { } | |
struct MyAction: Action { | |
// Note: We don't have to define the StateType alias, it infers it. | |
func reduce(state: MyState) -> MyState { | |
return state | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment