1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIViewAnimatingState(pub NSInteger);
impl UIViewAnimatingState {
    #[doc(alias = "UIViewAnimatingStateInactive")]
    pub const Inactive: Self = Self(0);
    #[doc(alias = "UIViewAnimatingStateActive")]
    pub const Active: Self = Self(1);
    #[doc(alias = "UIViewAnimatingStateStopped")]
    pub const Stopped: Self = Self(2);
}

unsafe impl Encode for UIViewAnimatingState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIViewAnimatingState {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIViewAnimatingPosition(pub NSInteger);
impl UIViewAnimatingPosition {
    #[doc(alias = "UIViewAnimatingPositionEnd")]
    pub const End: Self = Self(0);
    #[doc(alias = "UIViewAnimatingPositionStart")]
    pub const Start: Self = Self(1);
    #[doc(alias = "UIViewAnimatingPositionCurrent")]
    pub const Current: Self = Self(2);
}

unsafe impl Encode for UIViewAnimatingPosition {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIViewAnimatingPosition {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_protocol!(
    pub unsafe trait UIViewAnimating: NSObjectProtocol + IsMainThreadOnly {
        #[method(state)]
        unsafe fn state(&self) -> UIViewAnimatingState;

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

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

        #[method(setReversed:)]
        unsafe fn setReversed(&self, reversed: bool);

        #[method(fractionComplete)]
        unsafe fn fractionComplete(&self) -> CGFloat;

        #[method(setFractionComplete:)]
        unsafe fn setFractionComplete(&self, fraction_complete: CGFloat);

        #[method(startAnimation)]
        unsafe fn startAnimation(&self);

        #[method(startAnimationAfterDelay:)]
        unsafe fn startAnimationAfterDelay(&self, delay: NSTimeInterval);

        #[method(pauseAnimation)]
        unsafe fn pauseAnimation(&self);

        #[method(stopAnimation:)]
        unsafe fn stopAnimation(&self, without_finishing: bool);

        #[method(finishAnimationAtPosition:)]
        unsafe fn finishAnimationAtPosition(&self, final_position: UIViewAnimatingPosition);
    }

    unsafe impl ProtocolType for dyn UIViewAnimating {}
);

extern_protocol!(
    pub unsafe trait UIViewImplicitlyAnimating: UIViewAnimating + IsMainThreadOnly {
        #[cfg(feature = "block2")]
        #[optional]
        #[method(addAnimations:delayFactor:)]
        unsafe fn addAnimations_delayFactor(
            &self,
            animation: &block2::Block<dyn Fn()>,
            delay_factor: CGFloat,
        );

        #[cfg(feature = "block2")]
        #[optional]
        #[method(addAnimations:)]
        unsafe fn addAnimations(&self, animation: &block2::Block<dyn Fn()>);

        #[cfg(feature = "block2")]
        #[optional]
        #[method(addCompletion:)]
        unsafe fn addCompletion(&self, completion: &block2::Block<dyn Fn(UIViewAnimatingPosition)>);

        #[cfg(feature = "UITimingCurveProvider")]
        #[optional]
        #[method(continueAnimationWithTimingParameters:durationFactor:)]
        unsafe fn continueAnimationWithTimingParameters_durationFactor(
            &self,
            parameters: Option<&ProtocolObject<dyn UITimingCurveProvider>>,
            duration_factor: CGFloat,
        );
    }

    unsafe impl ProtocolType for dyn UIViewImplicitlyAnimating {}
);