Open mdevils opened 2 months ago
The reason it's not present is that the type of that field is DescType
, which comes from the CoreServices
framework, which is not yet mapped.
You can do the following in the meantime. Depending on your needs, you might have to pull in the core-services
crate too.
use icrate::Foundation::NSAppleEventDescriptor;
use objc2::msg_send;
use core_services::DescType; // If using `core-services`
type DescType = u32; // If not using `core-services`
pub fn get_descriptor_type(desc: &NSAppleEventDescriptor) -> DescType {
unsafe { msg_send![desc, descriptorType] }
}
@madsmtm thank you for your help. Could you please advice me, how do I call this method?
[NSAppleEventDescriptor init(string:)]
Info: https://developer.apple.com/documentation/foundation/nsappleeventdescriptor/1415227-init
First, have a look at the Objective-C documentation instead: https://developer.apple.com/documentation/foundation/nsappleeventdescriptor/1415227-descriptorwithstring?language=objc
Now you can do roughly what I did above, except using msg_send_id!
as this function is returning an object:
pub fn descriptor_with_string(string: &NSString) -> Id<NSAppleEventDescriptor> {
unsafe { msg_send_id![NSAppleEventDescriptor::class(), descriptorWithString: string] }
}
@madsmtm thank you!
Hello!
I wanted to access
descriptorType
atNSAppleEventDescriptor
in order to understand the type of the descriptor, but couldn't find the corresponding field in the generatedicrate
package. Is there a way to access that field for me?