Created
March 12, 2015 01:10
-
-
Save DanBrooker/ad9c51224ce2de19f73c 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
protocol DataModel { | |
} | |
protocol DataModelRelationships { | |
var relationships : [String: Array<DataModel>] { get } | |
} | |
protocol DataStore { | |
func add<T : DataModel>(element: T) | |
} | |
class ActualDataStore : DataStore { | |
func add<T : DataModel>(element: T) { | |
} | |
func add<U : protocol<DataModel,DataModelRelationships>>(element: U) { | |
updateRelationships(element) | |
} | |
func updateRelationships<U: protocol<DataModel,DataModelRelationships> >(element: U) { | |
println("this ran") | |
} | |
} | |
class AcutalObject : DataModel, DataModelRelationships { | |
var relationships : [String: Array<DataModel>] { | |
return ["something": []] | |
} | |
} | |
let object = AcutalObject() | |
let store = ActualDataStore() | |
store.add(object) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment