<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameplayKit",
  "identifier" : "/documentation/GameplayKit/GKComponentSystem",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKComponentSystem"
  },
  "title" : "GKComponentSystem"
}
-->

# GKComponentSystem

Manages periodic update messages for all component objects of a specified class.

```
class GKComponentSystem<ComponentType> where ComponentType : GKComponent
```

## Overview

A [`GKComponentSystem`](/documentation/GameplayKit/GKComponentSystem) object manages periodic update messages for components in a game that uses Entity-Component architecture. Use a component system to perform per-frame logic for all components of a specific class without traversing your game’s object hierarchy to dispatch update messages.

Each [`GKComponentSystem`](/documentation/GameplayKit/GKComponentSystem) object manages components of a specific [`GKComponent`](/documentation/GameplayKit/GKComponent) subclass. You create a component system with the [`init(componentClass:)`](/documentation/GameplayKit/GKComponentSystem/init(componentClass:)) initializer, specifying the component class it will work with. Then, you register the components used by the entities in your game with the [`addComponent(_:)`](/documentation/GameplayKit/GKComponentSystem/addComponent(_:)) or [`addComponent(foundIn:)`](/documentation/GameplayKit/GKComponentSystem/addComponent(foundIn:)) methods. The component system will then forward any component-specific messages it receives to all registered instances of its component class.

The most important of the component-specific messages is the [`update(deltaTime:)`](/documentation/GameplayKit/GKComponentSystem/update(deltaTime:)) method. Call this method from your game’s update/render loop—that is, from a method such as <doc://com.apple.documentation/documentation/SpriteKit/SKScene/update(_:)> (SpriteKit) or <doc://com.apple.documentation/documentation/SceneKit/SCNSceneRendererDelegate/renderer(_:updateAtTime:)> (SceneKit), or from a <doc://com.apple.documentation/documentation/QuartzCore/CADisplayLink> (iOS) or <doc://com.apple.documentation/documentation/CoreVideo/CVDisplayLink> (macOS) timer in a custom rendering engine. The component system then forwards to the [`update(deltaTime:)`](/documentation/GameplayKit/GKComponent/update(deltaTime:)) method of all the [`GKComponent`](/documentation/GameplayKit/GKComponent) subclass instances it manages, allowing those objects to perform per-frame update logic.

For more information on Entity-Component architecture, read [Entities and Components](https://developer.apple.com/library/archive/documentation/General/Conceptual/GameplayKit_Guide/EntityComponent.html#//apple_ref/doc/uid/TP40015172-CH6) in [GameplayKit Programming Guide](https://developer.apple.com/library/archive/documentation/General/Conceptual/GameplayKit_Guide/index.html#//apple_ref/doc/uid/TP40015172).

## Topics

### Creating a Component System

[`-  initWithComponentClass:`](/documentation/GameplayKit/GKComponentSystem/init(componentClass:))

Initializes a component system to manage components of the specified class.

### Managing a List of Components

[`componentClass`](/documentation/GameplayKit/GKComponentSystem/componentClass)

The class of components managed by the component system.

[`components`](/documentation/GameplayKit/GKComponentSystem/components)

The component system’s list of components.

[`-  addComponent:`](/documentation/GameplayKit/GKComponentSystem/addComponent(_:))

Adds a component instance to the component system.

[`-  addComponentWithEntity:`](/documentation/GameplayKit/GKComponentSystem/addComponent(foundIn:))

Adds any instances of the component system’s component class in the specified entity to the component system.

[`-  removeComponent:`](/documentation/GameplayKit/GKComponentSystem/removeComponent(_:))

Removes the specified component instance from the component system.

[`-  removeComponentWithEntity:`](/documentation/GameplayKit/GKComponentSystem/removeComponent(foundIn:))

Removes any instances of the component system’s component class in the specified entity from the component system.

### Performing Periodic Updates

[`-  updateWithDeltaTime:`](/documentation/GameplayKit/GKComponentSystem/update(deltaTime:))

Tells all component instances managed by the system to perform their custom periodic actions.

### Accessing Components With Subscript Syntax

[`-  objectAtIndexedSubscript:`](/documentation/GameplayKit/GKComponentSystem/subscript(_:))

Returns the component at the specified index in the system’s list of components.

### Instance Methods

[`-  classForGenericArgumentAtIndex:`](/documentation/GameplayKit/GKComponentSystem/classForGenericArgument(at:))

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSFastEnumeration`](/documentation/Foundation/NSFastEnumeration)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)