---
title: "recommendedLayerContentsScale(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsimage/recommendedlayercontentsscale(_:)"
---

# recommendedLayerContentsScale(_:)

Returns the recommended layer contents scale for this image.

## Declaration

```swift
func recommendedLayerContentsScale(_ preferredContentsScale: CGFloat) -> CGFloat
```

## Parameters

- `preferredContentsScale`: The preferred layer contents scale. Don’t use a higher scale factor if the image can’t provide it. If the image is resolution independent the return value will be the same as the input. If you specify 0.0 for this parameter, the method uses the scale factor for the default screen.

## Return Value

Return Value The recommended layer contents scale. This scale factor may be different than the one in the preferredContentsScale parameter.

## Discussion

Discussion Use this method to obtain the scale factor value that you pass to the layerContents(forContentsScale:) method. This method uses the image data to determine the scale factor that is best suited for creating an image that looks good in the layer.

## See Also

### Using Images with Core Animation

- [layerContents(forContentsScale:)](appkit/nsimage/layercontents(forcontentsscale:).md)
