-
-
Notifications
You must be signed in to change notification settings - Fork 11
StateComponentMapping
Used by the EntityState class to create the mappings of components to providers via a fluent interface.
public class StateComponentMapping
Creates a mapping for the component type to a specific component instance. A ComponentInstanceProvider is used for the mapping.
@discardableResult public func withInstance(_ component: Component) -> StateComponentMapping
- component: The component instance to use for the mapping
This ComponentMapping, so more modifications can be applied
Creates a mapping for the component type to new instances of the provided type. The type should be the same as or extend the type for this mapping. A ComponentTypeProvider is used for the mapping.
@discardableResult public func withType(_ type: ComponentInitializable.Type) -> Self
- type: The type of components to be created by this mapping
This ComponentMapping, so more modifications can be applied
Creates a mapping for the component type to a single instance of the provided type. The instance is not created until it is first requested. The type should be the same as or extend the type for this mapping. A ComponentSingletonProvider is used for the mapping.
@discardableResult public func withSingleton(_ type: ComponentInitializable.Type?) -> Self
- type: The type of the single instance to be created. If omitted, the type of the mapping is used.
This ComponentMapping, so more modifications can be applied
Creates a mapping for the component type to a method call. A DynamicComponentProvider is used for the mapping.
@discardableResult public func withMethod<C: Component>(_ closure: DynamicComponentProvider<C>.Closure) -> Self
- closure: The Closure instance to return the component instance
This ComponentMapping, so more modifications can be applied
Creates a mapping for the component type to any ComponentProvider.
@discardableResult public func withProvider(_ provider: ComponentProvider) -> Self
- provider: The component provider to use.
This ComponentMapping, so more modifications can be applied.
Maps through to the addMapping method of the EntityState that this mapping belongs to so that a fluent interface can be used when configuring entity states.
@discardableResult public func add(_ type: ComponentInitializable.Type) -> StateComponentMapping
- type: The type of component to add a mapping to the state for
The new ComponentMapping for that type
Generated at 2020-11-25T10:28:11+0000 using swift-doc 1.0.0-beta.5.
Types
- ComponentAdded
- ComponentIdentifier
- ComponentInstanceProvider
- ComponentRemoved
- ComponentSingletonProvider
- ComponentTypeProvider
- ComponentsBuilder.Context
- ComponentsBuilderPreview
- DefaultCodingStrategy
- DynamicCodingKey
- DynamicComponentProvider
- DynamicComponentProvider.Closure
- Entity
- Entity.ComponentsIterator
- EntityCreated
- EntityDestroyed
- EntityIdentifier
- EntityState
- EntityStateMachine
- Family
- Family.ComponentsIterator
- Family.EntityComponentIterator
- Family.EntityIterator
- FamilyMemberAdded
- FamilyMemberBuilderPreview
- FamilyMemberRemoved
- FamilyTraitSet
- LinearIncrementingEntityIdGenerator
- ManagedContiguousArray
- Nexus
- Nexus.EntitiesIterator
- Requires1
- Requires2
- Requires3
- Requires4
- Requires5
- Requires6
- Requires7
- Requires8
- Single
- StateComponentMapping
- StringHashing
- UnorderedSparseSet
- UnorderedSparseSet.ElementIterator
Protocols
- CodingStrategy
- Component
- ComponentProvider
- DefaultInitializable
- EntityIdentifierGenerator
- FamilyDecoding
- FamilyEncoding
- FamilyRequirementsManaging
- NexusEvent
- NexusEventDelegate
- RequiringComponents1
- RequiringComponents2
- RequiringComponents3
- RequiringComponents4
- RequiringComponents5
- RequiringComponents6
- RequiringComponents7
- RequiringComponents8
- SingleComponent
- TopLevelDecoder
- TopLevelEncoder