Created
February 9, 2019 07:26
-
-
Save paulw11/7a877a412d661f5e6665695bb70e85c2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Revisionable { | |
} | |
class RealType: Revisionable { | |
} | |
func setMyRealStuffRevision(entity name: String) -> [(RealType,Int)] { | |
return setThingRevision(entity: name) | |
} | |
func setThingRevision<GenericType:Revisionable>(entity name: String) -> [(GenericType,Int)] { | |
var resultArray = [(GenericType,Int)]() | |
// Here name contains the name of a Core Data entity and getArrayFromEntity is | |
// a local function, extracting an array from the contents of the entity. | |
for item in getArrayFromEntity(name) as! [GenericType] { | |
resultArray.append((item, 99)) | |
} | |
return resultArray | |
} | |
func getArrayFromEntity(_ name: String) -> [RealType] { | |
return [RealType()] | |
} | |
let x = setMyRealStuffRevision(entity: "Test") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment