Loadable
public protocol Loadable
Implemented by any type that wants to be loaded (and cached, and instanced) through the TiledKit Project
system. This makes it very easy to extend to a specific game engine.
-
Construct and return a
ResourceLoadersuitable for the protocol implementerDeclaration
Swift
static func loader(for project: Project) -> ResourceLoaderParameters
projectThe
ProjecttheResourceLoadershould work through to get any additional resources -
Instances should return
falseif they should not be cached (perhaps they are very large, temporary, or change over time)Declaration
Swift
var cache: Bool { get } -
When the
Loadablehas been cached this method will be called and if the object should create a copy of itself it can do it here. This is especially important for types that are classes as unless the instance is exactly the same (such as an image) and will not have been changed by previous instances, a copy should have been created. If it is acceptable that every instance of theLoadableis exactly the same object, the function can returnself.Declaration
Swift
func newInstance() -> Self
View on GitHub
Loadable Protocol Reference