Contents

preferredFrameSize()

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

Declaration

func preferredFrameSize() -> CGSize

Return Value

The layer’s preferred frame size.

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