objc2-ui-kit 0.3.2

Bindings to the UIKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_protocol!(
    /// UIFocusAnimationContext is used to provide UIKit-determined context about animations that are related to a focus update.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uifocusanimationcontext?language=objc)
    pub unsafe trait UIFocusAnimationContext: NSObjectProtocol + MainThreadOnly {
        /// The duration of the main animations in seconds.
        #[unsafe(method(duration))]
        #[unsafe(method_family = none)]
        fn duration(&self) -> NSTimeInterval;
    }
);

extern_class!(
    /// UIFocusAnimationCoordinator is used to coordinate disparate animations that are related to a focus update.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uifocusanimationcoordinator?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIFocusAnimationCoordinator;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for UIFocusAnimationCoordinator {}
);

impl UIFocusAnimationCoordinator {
    extern_methods!(
        #[cfg(feature = "block2")]
        /// Specifies focus-related animations that should be coordinated with the animations of the focusing or un-focusing view.
        ///
        /// Any animations specified will be run in the same animation context as the main animation. The completion block is invoked after the main animation completes.
        /// (Note that this may not be after all the coordinated animations specified by the call complete if the duration is not inherited.)
        ///
        /// It is perfectly legitimate to only specify a completion block.
        #[unsafe(method(addCoordinatedAnimations:completion:))]
        #[unsafe(method_family = none)]
        pub fn addCoordinatedAnimations_completion(
            &self,
            animations: Option<&block2::DynBlock<dyn Fn()>>,
            completion: Option<&block2::DynBlock<dyn Fn()>>,
        );

        #[cfg(feature = "block2")]
        /// Specifies focus-related animations that should be coordinated with the animations of the focusing item.
        ///
        /// Any animations specified will be run in the same animation context as the main animation. The completion block is invoked after the UIKit-defined animations complete.
        ///
        /// It is perfectly legitimate to only specify a completion block.
        ///
        /// A context object is provided in the animation block with details of the UIKit-defined animations being run for the focusing item.
        #[unsafe(method(addCoordinatedFocusingAnimations:completion:))]
        #[unsafe(method_family = none)]
        pub fn addCoordinatedFocusingAnimations_completion(
            &self,
            animations: Option<
                &block2::DynBlock<dyn Fn(NonNull<ProtocolObject<dyn UIFocusAnimationContext>>)>,
            >,
            completion: Option<&block2::DynBlock<dyn Fn()>>,
        );

        #[cfg(feature = "block2")]
        /// Specifies focus-related animations that should be coordinated with the animations of the un-focusing item.
        ///
        /// Any animations specified will be run in the same animation context as the main animation. The completion block is invoked after the UIKit-defined animations complete.
        ///
        /// It is perfectly legitimate to only specify a completion block.
        ///
        /// A context object is provided in the animation block with details of the UIKit-defined animations being run for the un-focusing item.
        #[unsafe(method(addCoordinatedUnfocusingAnimations:completion:))]
        #[unsafe(method_family = none)]
        pub fn addCoordinatedUnfocusingAnimations_completion(
            &self,
            animations: Option<
                &block2::DynBlock<dyn Fn(NonNull<ProtocolObject<dyn UIFocusAnimationContext>>)>,
            >,
            completion: Option<&block2::DynBlock<dyn Fn()>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl UIFocusAnimationCoordinator {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}