2020-03-15 23:10:43 -07:00
|
|
|
//! A module wrapping `NSUserActivity`.
|
2021-03-05 14:11:17 -08:00
|
|
|
//!
|
|
|
|
//! This is primarily used in handling app handoff between devices.
|
2020-03-15 23:10:43 -07:00
|
|
|
|
|
|
|
use objc::runtime::Object;
|
|
|
|
use objc_id::ShareId;
|
|
|
|
|
2020-03-17 16:55:09 -07:00
|
|
|
use crate::foundation::id;
|
|
|
|
|
2022-07-10 17:15:29 +02:00
|
|
|
/// Represents an `NSUserActivity`, which acts as a lightweight method to capture
|
|
|
|
/// the state of your app.
|
2021-03-05 14:11:17 -08:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct UserActivity(pub ShareId<Object>);
|
2020-03-15 23:10:43 -07:00
|
|
|
|
|
|
|
impl UserActivity {
|
|
|
|
/// An internal method for wrapping a system-provided activity.
|
|
|
|
pub(crate) fn with_inner(object: id) -> Self {
|
2021-03-05 14:11:17 -08:00
|
|
|
UserActivity(unsafe {
|
|
|
|
ShareId::from_ptr(object)
|
|
|
|
})
|
2020-03-15 23:10:43 -07:00
|
|
|
}
|
|
|
|
}
|