-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathConnectButton+Transition.swift
56 lines (46 loc) · 2.17 KB
/
ConnectButton+Transition.swift
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
//
// ConnectButton+Transition.swift
// IFTTT SDK
//
// Copyright © 2019 IFTTT. All rights reserved.
//
import Foundation
extension ConnectButton {
/// Groups button State and footer value into a single state transition
struct Transition {
/// An optional `AnimationState` to transition to.
let state: AnimationState?
/// An optional `LabelValue` to update the footer to.
let footerValue: LabelValue?
/// How long the transition should take.
let duration: TimeInterval
/// Creates a `Transition` for the connect button.
///
/// - Parameters:
/// - state: An `AnimationState` to transition the connect button to.
/// - duration: How long the transition should take. Defaults to 0.4 seconds.
/// - Returns: A configured `Transition`.
static func buttonState(_ state: AnimationState, duration: TimeInterval = 0.4) -> Transition {
return Transition(state: state, footerValue: nil, duration: duration)
}
/// Creates a `Transition` for the connect button.
///
/// - Parameters:
/// - state: An `AnimationState` to transition the connect button to.
/// - footerValue: A `LabelValue` to update the footer to.
/// - duration: How long the transition should take. Defaults to 0.4 seconds.
/// - Returns: A configured `Transition`.
static func buttonState(_ state: AnimationState, footerValue: LabelValue, duration: TimeInterval = 0.4) -> Transition {
return Transition(state: state, footerValue: footerValue, duration: duration)
}
/// Creates a footer `Transition` for the connect button.
///
/// - Parameters:
/// - value: A `LabelValue` to update the footer to.
/// - duration: How long the transition should take. Defaults to 0.4 seconds.
/// - Returns: A configured `Transition`.
static func footerValue(_ value: LabelValue, duration: TimeInterval = 0.4) -> Transition {
return Transition(state: nil, footerValue: value, duration: duration)
}
}
}