---
title: preferredFrameSize()
framework: quartzcore
role: symbol
role_heading: Instance Method
path: quartzcore/calayer/preferredframesize()
---

# preferredFrameSize()

Returns the preferred size of the layer in the coordinate space of its superlayer.

## Declaration

```swift
func preferredFrameSize() -> CGSize
```

## Return Value

Return Value The layer’s preferred frame size.

## Discussion

Discussion In macOS, the default implementation of this method calls the preferredSize(of:) method in Swift or the preferredSizeOfLayer: method in Objective-C of its layout manager—that is, the object in its layoutManager property. If that object does not exist or does not implement that method, this method returns the size of the layer’s current bounds rectangle mapped into the coordinate space of its superlayer.

## See Also

### Managing layer resizing and layout

- [layoutManager](quartzcore/calayer/layoutmanager.md)
- [setNeedsLayout()](quartzcore/calayer/setneedslayout().md)
- [layoutSublayers()](quartzcore/calayer/layoutsublayers().md)
- [layoutIfNeeded()](quartzcore/calayer/layoutifneeded().md)
- [needsLayout()](quartzcore/calayer/needslayout().md)
- [autoresizingMask](quartzcore/calayer/autoresizingmask.md)
- [resize(withOldSuperlayerSize:)](quartzcore/calayer/resize(witholdsuperlayersize:).md)
- [resizeSublayers(withOldSize:)](quartzcore/calayer/resizesublayers(witholdsize:).md)
