---
title: "allocWithZone:"
framework: objectivec
role: symbol
role_heading: Type Method
path: "objectivec/nsobject-swift.class/allocwithzone:"
---

# allocWithZone:

Returns a new instance of the receiving class.

## Declaration

```occ
+ (instancetype) allocWithZone:(struct _NSZone *) zone;
```

## Parameters

- `zone`: This parameter is ignored.

## Return Value

Return Value A new instance of the receiver.

## Discussion

Discussion The isa instance variable of the new instance is initialized to a data structure that describes the class; memory for all other instance variables is set to 0. You must use an init... method to complete the initialization process. For example: TheClass *newObject = [[TheClass allocWithZone:nil] init]; Do not override allocWithZone: to include any initialization code. Instead, class-specific versions of init... methods. This method exists for historical reasons; memory zones are no longer used by Objective-C.

## See Also

### Creating, Copying, and Deallocating Objects

- [alloc](objectivec/nsobject-swift.class/alloc.md)
- [init()](objectivec/nsobject-swift.class/init().md)
- [copy()](objectivec/nsobject-swift.class/copy().md)
- [copyWithZone:](objectivec/nsobject-swift.class/copywithzone:.md)
- [mutableCopy()](objectivec/nsobject-swift.class/mutablecopy().md)
- [mutableCopyWithZone:](objectivec/nsobject-swift.class/mutablecopywithzone:.md)
- [dealloc](objectivec/nsobject-swift.class/dealloc.md)
- [new](objectivec/nsobject-swift.class/new.md)
