---
title: "class_addProperty(_:_:_:_:)"
framework: Objective-C Runtime
role: symbol
role_heading: Function
platforms: [iOS 4.3+, iPadOS 4.3+, Mac Catalyst 13.1+, macOS 10.7+, tvOS 9.0+, visionOS 1.0+, watchOS 1.0+]
path: "objectivec/class_addproperty(_:_:_:_:)"
---

# class_addProperty(_:_:_:_:)

Adds a property to a class.

## Declaration

```swift
func class_addProperty(_ cls: AnyClass?, _ name: UnsafePointer<CChar>, _ attributes: UnsafePointer<objc_property_attribute_t>?, _ attributeCount: UInt32) -> Bool
```

## Parameters

- `cls`: The class to modify.
- `name`: The name of the property.
- `attributes`: An array of property attributes.
- `attributeCount`: The number of attributes in attributes.

## Return Value

Return Value YES if the property was added successfully; otherwise NO (for example, this function returns NO if the class already has that property).

## See Also

### Working with Classes

- [class_getName(_:)](objectivec/class_getname(_:).md)
- [class_getSuperclass(_:)](objectivec/class_getsuperclass(_:).md)
- [class_setSuperclass(_:_:)](objectivec/class_setsuperclass(_:_:).md)
- [class_isMetaClass(_:)](objectivec/class_ismetaclass(_:).md)
- [class_getInstanceSize(_:)](objectivec/class_getinstancesize(_:).md)
- [class_getInstanceVariable(_:_:)](objectivec/class_getinstancevariable(_:_:).md)
- [class_getClassVariable(_:_:)](objectivec/class_getclassvariable(_:_:).md)
- [class_addIvar(_:_:_:_:_:)](objectivec/class_addivar(_:_:_:_:_:).md)
- [class_copyIvarList(_:_:)](objectivec/class_copyivarlist(_:_:).md)
- [class_getIvarLayout(_:)](objectivec/class_getivarlayout(_:).md)
- [class_setIvarLayout(_:_:)](objectivec/class_setivarlayout(_:_:).md)
- [class_getWeakIvarLayout(_:)](objectivec/class_getweakivarlayout(_:).md)
- [class_setWeakIvarLayout(_:_:)](objectivec/class_setweakivarlayout(_:_:).md)
- [class_getProperty(_:_:)](objectivec/class_getproperty(_:_:).md)
- [class_copyPropertyList(_:_:)](objectivec/class_copypropertylist(_:_:).md)
