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