ObjectTypes

public struct ObjectTypes : Loadable

Object types represent pre-defined sets of objects that can be applied to Tiled objects. ObjectTypes captures these definitions and enables both reading and writing of the file of definitions. That can be useful for programmatically creating the object types for use in Tiled.

  • Returns the ResourceLoader for ObjectTypes

    Declaration

    Swift

    public static func loader(for project: Project) -> ResourceLoader
  • ObjectType files are not cached

    Declaration

    Swift

    public let cache: Bool
  • The number of definitions

    Declaration

    Swift

    public var count: Int { get }
  • Creates a new instance of this object

    Declaration

    Swift

    public func newInstance() -> ObjectTypes
  • Get or set an object with the specified name

    Declaration

    Swift

    public subscript(named: String) -> ObjectType? { get set }
  • The names of all defined ObjectTypes

    Declaration

    Swift

    public var allNames: [String] { get }
  • Undocumented

    Declaration

    Swift

    public func write(to url: URL) throws
  • Creates a new instance of an ObjectTypes object

    Declaration

    Swift

    public init()
  • Creates a new instance of the object types with old types defined for the engine (identified as having the Engine.prefix) removed, and the current types added. User defined object types (in Tiled) are preserved unchanged

    Declaration

    Swift

    func extendedWith<EngineType>(_ engineType: EngineType.Type) -> ObjectTypes where EngineType : Engine

    Parameters

    engineType

    The Engine to use

    Return Value

    A new ObjectTypes object that is updated and can be used to save (to the same location) or assign to the a Project