rust_macios/appkit/
ns_storyboard.rs1use objc::{msg_send, sel, sel_impl};
2
3use crate::{
4 foundation::NSBundle,
5 object,
6 objective_c_runtime::{
7 id, nil,
8 traits::{FromId, PNSObject},
9 },
10};
11
12use super::NSStoryboardName;
13
14object! {
15 unsafe pub struct NSStoryboard
17}
18
19impl INSStoryboard for NSStoryboard {}
20
21pub trait INSStoryboard: PNSObject {
23 fn tm_storyboard_with_name_bundle(name: NSStoryboardName, bundle: Option<NSBundle>) -> Self
25 where
26 Self: Sized + FromId,
27 {
28 unsafe {
29 Self::from_id(
30 msg_send![Self::m_class(), storyboardWithName: name bundle: match bundle {
31 Some(val) => val.m_self(),
32 None => nil
33 }],
34 )
35 }
36 }
37
38 fn tp_main_storyboard() -> NSStoryboard {
40 unsafe { NSStoryboard::from_id(msg_send![Self::m_class(), mainStoryboard]) }
41 }
42
43 fn im_instantiate_initial_controller(&self) -> id {
48 unsafe { msg_send![Self::m_class(), instantiateInitialController] }
49 }
50}