pub struct SCContentSharingPickerConfiguration { /* private fields */ }Expand description
Configuration for the content sharing picker
Implementations§
Source§impl SCContentSharingPickerConfiguration
impl SCContentSharingPickerConfiguration
Sourcepub fn new() -> Result<Self, SCError>
pub fn new() -> Result<Self, SCError>
§Errors
Returns SCError::FeatureNotAvailable when run on macOS older than
14.0.
Sourcepub fn default_from_system() -> Result<Self, SCError>
pub fn default_from_system() -> Result<Self, SCError>
Construct a configuration initialised with the system’s default values
(the equivalent of Apple’s SCContentSharingPicker.shared.defaultConfiguration).
Use this when you want “system defaults plus my one tweak” — call this
to get the baseline, then mutate the fields you care about. Compared
to SCContentSharingPickerConfiguration::new(), which starts from a
blank-slate SCContentSharingPickerConfiguration(), this preserves
any system-wide picker preferences the OS applies to fresh
configurations (e.g. allowed picker modes, default exclusion lists).
§Errors
Returns SCError::FeatureNotAvailable when run on macOS older than
14.0.
§Examples
use screencapturekit::content_sharing_picker::*;
// Start from the system defaults, then override only what you need.
let mut config = SCContentSharingPickerConfiguration::default_from_system()
.expect("read the default picker configuration");
config.set_excluded_bundle_ids(&["com.apple.dock"]).expect("bundle IDs have no NUL byte");Sourcepub fn set_allowed_picker_modes(&mut self, modes: &[SCContentSharingPickerMode])
pub fn set_allowed_picker_modes(&mut self, modes: &[SCContentSharingPickerMode])
Set allowed picker modes
Sourcepub fn allowed_picker_modes(&self) -> Vec<SCContentSharingPickerMode>
pub fn allowed_picker_modes(&self) -> Vec<SCContentSharingPickerMode>
Get the currently allowed picker modes.
Sourcepub fn set_allows_changing_selected_content(&mut self, allows: bool)
pub fn set_allows_changing_selected_content(&mut self, allows: bool)
Set whether the user can change the selected content while sharing
When true, the user can modify their selection during an active session.
Sourcepub fn allows_changing_selected_content(&self) -> bool
pub fn allows_changing_selected_content(&self) -> bool
Get whether changing selected content is allowed
Sourcepub fn set_excluded_bundle_ids(
&mut self,
bundle_ids: &[&str],
) -> Result<(), InteriorNulError>
pub fn set_excluded_bundle_ids( &mut self, bundle_ids: &[&str], ) -> Result<(), InteriorNulError>
Set bundle identifiers to exclude from the picker
Applications with these bundle IDs will not appear in the picker.
§Errors
Returns InteriorNulError — leaving the configuration unchanged — if
any bundle ID contains an interior NUL byte.
Sourcepub fn excluded_bundle_ids(&self) -> Vec<String>
pub fn excluded_bundle_ids(&self) -> Vec<String>
Get the list of excluded bundle identifiers
A bundle ID that does not fit in the transfer buffer is skipped rather
than returned truncated, so the result can be shorter than
excluded_bundle_ids_count.
Sourcepub fn excluded_bundle_ids_count(&self) -> usize
pub fn excluded_bundle_ids_count(&self) -> usize
Number of excluded bundle identifiers configured.
Sourcepub fn set_excluded_window_ids(&mut self, window_ids: &[u32])
pub fn set_excluded_window_ids(&mut self, window_ids: &[u32])
Set window IDs to exclude from the picker
Windows with these IDs will not appear in the picker.
Sourcepub fn excluded_window_ids(&self) -> Vec<u32>
pub fn excluded_window_ids(&self) -> Vec<u32>
Get the list of excluded window IDs
pub const fn as_ptr(&self) -> *const c_void
Trait Implementations§
Source§impl Clone for SCContentSharingPickerConfiguration
impl Clone for SCContentSharingPickerConfiguration
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
Produce an independent configuration with the same values.
Deliberately not the retain-based clone the other wrappers in this
crate use. Those wrap immutable Objective-C objects, where sharing one
instance between handles is unobservable. This type is different: it
wraps a mutable Swift box and exposes &mut self setters, so a
refcount-only clone would let a &mut on one handle mutate state that
another handle observes through a shared & — and, with Send + Sync,
from another thread at the same time.
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more