---
title: "class_createInstance(_:_:)"
framework: objectivec
role: symbol
role_heading: Function
path: "objectivec/class_createinstance(_:_:)"
---

# class_createInstance(_:_:)

Creates an instance of a class, allocating memory for the class in the default malloc memory zone.

## Declaration

```swift
func class_createInstance(_ cls: AnyClass?, _ extraBytes: Int) -> Any?
```

## Parameters

- `cls`: The class that you want to allocate an instance of.
- `extraBytes`: An integer indicating the number of extra bytes to allocate. The additional bytes can be used to store additional instance variables beyond those defined in the class definition.

## Return Value

Return Value An instance of the class cls.
