Created
February 16, 2015 22:47
-
-
Save nomothetis/386e13e25a93cd242f28 to your computer and use it in GitHub Desktop.
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
import Foundation | |
struct ConversationViewSnapshot : Diffable { | |
func diffWith(diffable: ConversationViewSnapshot) -> ConversationViewDiff { | |
return ConversationViewDiff.None | |
} | |
func applyDiff(diff: ConversationViewDiff) -> ConversationViewSnapshot { | |
return self | |
} | |
} | |
enum ConversationViewDiff : Diff { | |
typealias BaseType = ConversationViewSnapshot | |
case None | |
func mergeWithDiff(diff: ConversationViewDiff) -> ConversationViewDiff { | |
return .None | |
} | |
} | |
struct Conversation { | |
} | |
protocol Diff { | |
typealias BaseType | |
func mergeWithDiff(diff:Self) -> Self | |
} | |
protocol Diffable { | |
func diffWith<B: Diff where B.BaseType == Self>(diffable:Self) -> B | |
func applyDiff<B: Diff where B.BaseType == Self>(diff:B) -> Self | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment