|
3 | 3 | //! **Untested**! |
4 | 4 | //! |
5 | 5 | //! Works on macOS >= 10.15 or iOS > 7.0! |
6 | | -use objc2::ffi::NSUInteger; |
7 | | -use objc2::rc::{Id, Owned, Shared}; |
8 | | -use objc2::runtime::Object; |
9 | | -use objc2::{class, msg_send, msg_send_bool, msg_send_id}; |
10 | | -use std::ffi::c_void; |
11 | 6 |
|
12 | | -#[cfg(feature = "apple")] |
13 | | -#[link(name = "AVFoundation", kind = "framework")] |
14 | | -extern "C" {} |
15 | | -#[cfg(feature = "apple")] |
16 | | -#[link(name = "Foundation", kind = "framework")] |
17 | | -extern "C" {} |
18 | | - |
19 | | -const UTF8_ENCODING: NSUInteger = 4; |
| 7 | +#[cfg(not(talk_to_me_example))] |
| 8 | +fn main() { |
| 9 | + panic!("pass the `--cfg talk_to_me_example` flag to run this example!"); |
| 10 | +} |
20 | 11 |
|
| 12 | +#[cfg(talk_to_me_example)] |
21 | 13 | fn main() { |
| 14 | + use objc2::ffi::NSUInteger; |
| 15 | + use objc2::rc::{Id, Owned, Shared}; |
| 16 | + use objc2::runtime::Object; |
| 17 | + use objc2::{class, msg_send, msg_send_bool, msg_send_id}; |
| 18 | + use std::ffi::c_void; |
| 19 | + |
| 20 | + #[cfg(feature = "apple")] |
| 21 | + #[link(name = "AVFoundation", kind = "framework")] |
| 22 | + extern "C" {} |
| 23 | + #[cfg(feature = "apple")] |
| 24 | + #[link(name = "Foundation", kind = "framework")] |
| 25 | + extern "C" {} |
| 26 | + |
| 27 | + const UTF8_ENCODING: NSUInteger = 4; |
| 28 | + |
22 | 29 | let text = "Hello from Rust!"; |
23 | 30 |
|
24 | 31 | // Note: objc2-foundation has functionality to do this safely! |
|
0 commit comments