hhas / SwiftAutomation

High-level Apple event framework for Swift. Currently implements client-side; server-side TBD.
https://hhas.bitbucket.io/
62 stars 5 forks source link

unpackAsQDPoint crash #4

Closed ronzo99 closed 3 years ago

ronzo99 commented 3 years ago

unpackAsQDPoint crashes at: let point: Rect = descriptor.data.withUnsafeBytes { buffer in buffer.bindMemory(to: Rect.self)[0]

The fix is to replace "Rect" with "Point" at two places in that line.

This can be tested by targeting Finder, which uses a point for its "desktop position" folder property:

let finder = Finder() print("TEST: get desktop position of folder \"TEMP\"") print(try finder.folders["TEMP"].desktopPosition.get()) // [2301, 554]

hhas commented 3 years ago

Thanks for being thorough. Careless copy-paste error on my part. Fixed in AppleEvents rev e72f117.