objc2 icon indicating copy to clipboard operation
objc2 copied to clipboard

Some suggestions regarding objc2-foundation and block2

Open libark opened this issue 3 months ago • 2 comments

  1. When using NSArray or NSDictionary, their values are usually generic types, so they need to be defined using AnyObject, such as NSMutableDictionary::<NSString, AnyObject>. However, for types like NSNumber, multiple calls to into_super or unsafe methods such as Id::cast are required to convert them to AnyObject. Considering the frequency of this operation, could a safe method be provided to complete the conversion from NSNumber to AnyObject in one step?

  2. When using many Apple frameworks, it is necessary to pass the static CFString exported from the framework to NSString. Could a method be added for NSString, create NString from a raw pointer?

  3. When using block2, all parameter and return value types must implement Encode trait, but many Apple frameworks do not use Objective-C interfaces and types. Could a feature be added to block2 to allow it to be used in C interface framework wrappers, replace block?

libark avatar May 11 '24 16:05 libark