objc2-foundation 0.3.0

Bindings to the Foundation framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#![cfg(feature = "NSString")]
use objc2::{rc::Retained, runtime::ProtocolObject};
use objc2_foundation::{NSCopying, NSMutableCopying, NSString};

#[test]
fn copy() {
    let obj = NSString::new();
    let protocol_object: &ProtocolObject<dyn NSCopying> = ProtocolObject::from_ref(&*obj);
    let _: Retained<ProtocolObject<dyn NSCopying>> = protocol_object.copy();
}

#[test]
fn copy_mutable() {
    let obj = NSString::new();
    let protocol_object: &ProtocolObject<dyn NSMutableCopying> = ProtocolObject::from_ref(&*obj);
    let _: Retained<ProtocolObject<dyn NSMutableCopying>> = protocol_object.mutableCopy();
}