convert(_:from:)
Converts a size from another view’s coordinate system to that of the view.
Declaration
func convert(_ size: NSSize, from view: NSView?) -> NSSizeParameters
- size:
The size (width and height) in view’s coordinate system.
- view:
The view with
sizein its coordinate system. Bothviewand the view must belong to the same Nswindow object, and that window must not benil. Ifviewisnil, this method converts from window coordinates instead.
Return Value
The converted size, as an NSSize structure.
Discussion
The returned NSSize values are always forced to have positive a width and height.
You can also use this method to get a view’s current magnification or zoom level, if it’s been changed from the default scale. Specifically, if you convert a known size from the window’s base coordinate space to that of view, the result is the current zoom level.
See Also
Related Documentation
Converting Coordinate Values
backingAlignedRect(_:options:)convertFromBacking(_:)convertToBacking(_:)convertFromLayer(_:)convertToLayer(_:)convertFromBacking(_:)convertToBacking(_:)convertFromLayer(_:)convertToLayer(_:)convertFromBacking(_:)convertToBacking(_:)convertFromLayer(_:)convertToLayer(_:)convert(_:from:)convert(_:to:)