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
use core::panic::{RefUnwindSafe, UnwindSafe};

use crate::NSBundle;

impl UnwindSafe for NSBundle {}
impl RefUnwindSafe for NSBundle {}

impl NSBundle {
    #[cfg(feature = "NSString")]
    #[cfg(feature = "NSDictionary")]
    pub fn name(&self) -> Option<objc2::rc::Retained<crate::NSString>> {
        let info = self.infoDictionary()?;
        let name = info.objectForKey(crate::ns_string!("CFBundleName"))?;
        Some(name.downcast().expect("CFBundleName to be NSString"))
    }
}