use objc2::rc::autoreleasepool;
use objc2_foundation::{NSArray, NSCopying, NSDictionary, NSObject, NSString};
fn main() {
let obj = NSObject::new();
#[allow(clippy::eq_op)]
{
println!("{:?} == {:?}? {:?}", obj, obj, obj == obj);
}
let obj2 = NSObject::new();
println!("{:?} == {:?}? {:?}", obj, obj2, obj == obj2);
let objs = vec![obj, obj2];
let array = NSArray::from_vec(objs);
for obj in array.iter() {
println!("{:?}", obj);
}
println!("{}", array.len());
let mut objs = NSArray::into_vec(array);
let obj = objs.pop().unwrap();
let string = NSString::from_str("Hello, world!");
autoreleasepool(|pool| {
println!("{}", string.as_str(pool));
let string2 = string.copy();
println!("{}", string2.as_str(pool));
});
let keys = &[&*string];
let vals = vec![obj];
let dict = NSDictionary::from_keys_and_objects(keys, vals);
println!("{:?}", dict.get(&string));
println!("{}", dict.len());
}