icrate 0.1.2

Bindings to Apple's frameworks
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::AppKit::*;
use crate::Foundation::*;
use crate::MediaPlayer::*;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "MediaPlayer_MPAdTimeRange")]
    pub struct MPAdTimeRange;

    #[cfg(feature = "MediaPlayer_MPAdTimeRange")]
    unsafe impl ClassType for MPAdTimeRange {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "MediaPlayer_MPAdTimeRange")]
unsafe impl NSCopying for MPAdTimeRange {}

#[cfg(feature = "MediaPlayer_MPAdTimeRange")]
unsafe impl NSObjectProtocol for MPAdTimeRange {}

extern_methods!(
    #[cfg(feature = "MediaPlayer_MPAdTimeRange")]
    unsafe impl MPAdTimeRange {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "MediaPlayer_MPNowPlayingSession")]
    pub struct MPNowPlayingSession;

    #[cfg(feature = "MediaPlayer_MPNowPlayingSession")]
    unsafe impl ClassType for MPNowPlayingSession {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "MediaPlayer_MPNowPlayingSession")]
unsafe impl NSObjectProtocol for MPNowPlayingSession {}

extern_methods!(
    #[cfg(feature = "MediaPlayer_MPNowPlayingSession")]
    unsafe impl MPNowPlayingSession {
        #[cfg(all(feature = "AVFoundation_AVPlayer", feature = "Foundation_NSArray"))]
        #[method_id(@__retain_semantics Init initWithPlayers:)]
        pub unsafe fn initWithPlayers(
            this: Allocated<Self>,
            players: &NSArray<AVPlayer>,
        ) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[cfg(all(feature = "AVFoundation_AVPlayer", feature = "Foundation_NSArray"))]
        #[method_id(@__retain_semantics Other players)]
        pub unsafe fn players(&self) -> Id<NSArray<AVPlayer>>;

        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Id<ProtocolObject<dyn MPNowPlayingSessionDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn MPNowPlayingSessionDelegate>>,
        );

        #[method(automaticallyPublishesNowPlayingInfo)]
        pub unsafe fn automaticallyPublishesNowPlayingInfo(&self) -> bool;

        #[method(setAutomaticallyPublishesNowPlayingInfo:)]
        pub unsafe fn setAutomaticallyPublishesNowPlayingInfo(
            &self,
            automatically_publishes_now_playing_info: bool,
        );

        #[cfg(feature = "MediaPlayer_MPNowPlayingInfoCenter")]
        #[method_id(@__retain_semantics Other nowPlayingInfoCenter)]
        pub unsafe fn nowPlayingInfoCenter(&self) -> Id<MPNowPlayingInfoCenter>;

        #[cfg(feature = "MediaPlayer_MPRemoteCommandCenter")]
        #[method_id(@__retain_semantics Other remoteCommandCenter)]
        pub unsafe fn remoteCommandCenter(&self) -> Id<MPRemoteCommandCenter>;

        #[method(canBecomeActive)]
        pub unsafe fn canBecomeActive(&self) -> bool;

        #[method(isActive)]
        pub unsafe fn isActive(&self) -> bool;

        #[method(becomeActiveIfPossibleWithCompletion:)]
        pub unsafe fn becomeActiveIfPossibleWithCompletion(
            &self,
            completion: Option<&Block<(Bool,), ()>>,
        );

        #[cfg(feature = "AVFoundation_AVPlayer")]
        #[method(addPlayer:)]
        pub unsafe fn addPlayer(&self, player: &AVPlayer);

        #[cfg(feature = "AVFoundation_AVPlayer")]
        #[method(removePlayer:)]
        pub unsafe fn removePlayer(&self, player: &AVPlayer);
    }
);

extern_protocol!(
    pub unsafe trait MPNowPlayingSessionDelegate: NSObjectProtocol {
        #[cfg(feature = "MediaPlayer_MPNowPlayingSession")]
        #[optional]
        #[method(nowPlayingSessionDidChangeActive:)]
        unsafe fn nowPlayingSessionDidChangeActive(
            &self,
            now_playing_session: &MPNowPlayingSession,
        );

        #[cfg(feature = "MediaPlayer_MPNowPlayingSession")]
        #[optional]
        #[method(nowPlayingSessionDidChangeCanBecomeActive:)]
        unsafe fn nowPlayingSessionDidChangeCanBecomeActive(
            &self,
            now_playing_session: &MPNowPlayingSession,
        );
    }

    unsafe impl ProtocolType for dyn MPNowPlayingSessionDelegate {}
);