NSValue cant be initialized with CGAffineTransform

Number:rdar://25507932 Date Originated:04 / 02 / 2016
Status:Open Resolved:
Product:Mac OS X Product Version:
Classification: Reproducible:
On iOS, NSValue can be initialized using CGAffineTransform.
The Mac counterpart does not exists, despite the fact that most of the initializers are equal on both platforms.
NSGeometry simply misses methods in its NSValue extension that UIGeometry has.

Steps to Reproduce:
iOS: let value = NSValue(CGAffineTransform: transform)
Mac: let value = NSValue(CGAffineTransform: transform) does not work. Therefore it is difficult to use a CGAffineTransform in, let's say, a CIFilter.

Expected Results:
Both platforms should be able to initialize a NSValue from a given CGAffineTransform.

Actual Results:
CGAffineTransform can not be wrapped in an NSValue using Swift (or at least I haven't found a way yet).

Latest release build.

I added sample code in playgrounds that demonstrate the issue.

MacBook Pro (Retina, 13-inch, Late 2013), OS X 10.11.4

'NSValue Sample Code.zip' was successfully uploaded.



var transform = CGAffineTransform(scaleX: 1, y: 1) let transformValue = withUnsafePointer(to: &transform) { NSValue(bytes: $0, objCType: "{CGAffineTransform=dddddd}") }

By sokolov.lev95 at June 7, 2023, 10:31 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!