1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use objc::{msg_send, sel, sel_impl};
use crate::{
foundation::NSBundle,
object,
objective_c_runtime::{
id, nil,
traits::{FromId, PNSObject},
},
};
use super::NSStoryboardName;
object! {
/// An encapsulation of the design-time view controller and window controller graph represented in an Interface Builder storyboard resource file.
unsafe pub struct NSStoryboard
}
impl INSStoryboard for NSStoryboard {}
/// An encapsulation of the design-time view controller and window controller graph represented in an Interface Builder storyboard resource file.
pub trait INSStoryboard: PNSObject {
/// Creates a storyboard based on the named storyboard file in the specified bundle.
fn tm_storyboard_with_name_bundle(name: NSStoryboardName, bundle: Option<NSBundle>) -> Self
where
Self: Sized + FromId,
{
unsafe {
Self::from_id(
msg_send![Self::m_class(), storyboardWithName: name bundle: match bundle {
Some(val) => val.m_self(),
None => nil
}],
)
}
}
/// The app's main storyboard.
fn tp_main_storyboard() -> NSStoryboard {
unsafe { NSStoryboard::from_id(msg_send![Self::m_class(), mainStoryboard]) }
}
/* Loading the Initial View Controller
*/
/// Creates the initial view controller or window controller from a storyboard.
fn im_instantiate_initial_controller(&self) -> id {
unsafe { msg_send![Self::m_class(), instantiateInitialController] }
}
}