---
title: "addComponent(_:)"
framework: gameplaykit
role: symbol
role_heading: Instance Method
path: "gameplaykit/gkcomponentsystem/addcomponent(_:)"
---

# addComponent(_:)

Adds a component instance to the component system.

## Declaration

```swift
func addComponent(_ component: ComponentType)
```

## Parameters

- `component`: An instance of a doc://com.apple.gameplaykit/documentation/GameplayKit/GKComponent subclass.

## Discussion

Discussion The component instance must be of the same GKComponent subclass specified by the componentClass property.

## See Also

### Managing a List of Components

- [componentClass](gameplaykit/gkcomponentsystem/componentclass.md)
- [components](gameplaykit/gkcomponentsystem/components.md)
- [addComponent(foundIn:)](gameplaykit/gkcomponentsystem/addcomponent(foundin:).md)
- [removeComponent(_:)](gameplaykit/gkcomponentsystem/removecomponent(_:).md)
- [removeComponent(foundIn:)](gameplaykit/gkcomponentsystem/removecomponent(foundin:).md)
