---
title: "encodeArray(ofObjCType:count:at:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nscoder/encodearray(ofobjctype:count:at:)"
---

# encodeArray(ofObjCType:count:at:)

Encodes an array of the given Objective-C type, provided the number of items and a pointer.

## Declaration

```swift
func encodeArray(ofObjCType type: UnsafePointer<CChar>, count: Int, at array: UnsafeRawPointer)
```

## Discussion

Discussion The values are encoded from the buffer beginning at address. itemType must contain exactly one type code. NSCoder’s implementation invokes encodeValue(ofObjCType:at:) to encode the entire array of items. Subclasses that implement the encodeValue(ofObjCType:at:) method do not need to override this method. This method must be matched by a subsequent decodeArray(ofObjCType:count:at:) message. For information on creating an Objective-C type code suitable for itemType, see Type Encodings. Special Considerations You should not use this method to encode C arrays of Objective-C objects. See decodeArray(ofObjCType:count:at:) for more details.

## See Also

### Encoding General Data

- [encode(_:forKey:)](foundation/nscoder/encode(_:forkey:)-7o6mu.md)
- [encodeBycopyObject(_:)](foundation/nscoder/encodebycopyobject(_:).md)
- [encodeByrefObject(_:)](foundation/nscoder/encodebyrefobject(_:).md)
- [encodeBytes(_:length:)](foundation/nscoder/encodebytes(_:length:).md)
- [encodeBytes(_:length:forKey:)](foundation/nscoder/encodebytes(_:length:forkey:).md)
- [encodeConditionalObject(_:)](foundation/nscoder/encodeconditionalobject(_:).md)
- [encodeConditionalObject(_:forKey:)](foundation/nscoder/encodeconditionalobject(_:forkey:).md)
- [encode(_:)](foundation/nscoder/encode(_:)-1qd1e.md)
- [encode(_:forKey:)](foundation/nscoder/encode(_:forkey:)-9xiiu.md)
- [encode(_:forKey:)](foundation/nscoder/encode(_:forkey:)-84cez.md)
- [encodeCInt(_:forKey:)](foundation/nscoder/encodecint(_:forkey:).md)
- [encode(_:forKey:)](foundation/nscoder/encode(_:forkey:)-2dprz.md)
- [encode(_:forKey:)](foundation/nscoder/encode(_:forkey:)-5sk4z.md)
- [encode(_:forKey:)](foundation/nscoder/encode(_:forkey:)-dixg.md)
- [encode(_:)](foundation/nscoder/encode(_:)-9648d.md)
