Skip to content

Commit e7d7e00

Browse files
committed
Adjust edge animation timing
1 parent 3883abc commit e7d7e00

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

SwiftMessages.xcodeproj/project.pbxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
2290958125D9D407002E8111 /* UILayoutPriority+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2290958025D9D407002E8111 /* UILayoutPriority+Extensions.swift */; };
5656
2298C2051EE47DC900E2DDC1 /* Weak.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2298C2041EE47DC900E2DDC1 /* Weak.swift */; };
5757
2298C2071EE480D000E2DDC1 /* Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2298C2061EE480D000E2DDC1 /* Animator.swift */; };
58-
2298C2091EE486E300E2DDC1 /* TopBottomAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2298C2081EE486E300E2DDC1 /* TopBottomAnimation.swift */; };
58+
2298C2091EE486E300E2DDC1 /* EdgeAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2298C2081EE486E300E2DDC1 /* EdgeAnimation.swift */; };
5959
22DFC9161EFF30F6001B1CA1 /* CenteredView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 22DFC9151EFF30F6001B1CA1 /* CenteredView.xib */; };
6060
22DFC9181F00674E001B1CA1 /* PhysicsPanHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22DFC9171F00674E001B1CA1 /* PhysicsPanHandler.swift */; };
6161
22E01F641E74EC8B00ACE19A /* MaskingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22E01F631E74EC8B00ACE19A /* MaskingView.swift */; };
@@ -143,7 +143,7 @@
143143
2290958025D9D407002E8111 /* UILayoutPriority+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILayoutPriority+Extensions.swift"; sourceTree = "<group>"; };
144144
2298C2041EE47DC900E2DDC1 /* Weak.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Weak.swift; sourceTree = "<group>"; };
145145
2298C2061EE480D000E2DDC1 /* Animator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Animator.swift; sourceTree = "<group>"; };
146-
2298C2081EE486E300E2DDC1 /* TopBottomAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TopBottomAnimation.swift; sourceTree = "<group>"; };
146+
2298C2081EE486E300E2DDC1 /* EdgeAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EdgeAnimation.swift; sourceTree = "<group>"; };
147147
22A2EA6E24EC6CFA00BB2540 /* Package.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
148148
22DFC9151EFF30F6001B1CA1 /* CenteredView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CenteredView.xib; path = Resources/CenteredView.xib; sourceTree = "<group>"; };
149149
22DFC9171F00674E001B1CA1 /* PhysicsPanHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhysicsPanHandler.swift; sourceTree = "<group>"; };
@@ -221,7 +221,7 @@
221221
2244656C1EF1D62700C50413 /* Animations */ = {
222222
isa = PBXGroup;
223223
children = (
224-
2298C2081EE486E300E2DDC1 /* TopBottomAnimation.swift */,
224+
2298C2081EE486E300E2DDC1 /* EdgeAnimation.swift */,
225225
2270044A1FAFA6DD0045DDC3 /* PhysicsAnimation.swift */,
226226
22DFC9171F00674E001B1CA1 /* PhysicsPanHandler.swift */,
227227
);
@@ -556,7 +556,7 @@
556556
86BBA8FF1D5E040600FE8F16 /* Presenter.swift in Sources */,
557557
86BBA9051D5E040C00FE8F16 /* Theme.swift in Sources */,
558558
86BBA9081D5E040C00FE8F16 /* Error.swift in Sources */,
559-
2298C2091EE486E300E2DDC1 /* TopBottomAnimation.swift in Sources */,
559+
2298C2091EE486E300E2DDC1 /* EdgeAnimation.swift in Sources */,
560560
86589D471D64B6E40041676C /* BaseView.swift in Sources */,
561561
225304622290C76E00A03ACF /* NSLayoutConstraint+Extensions.swift in Sources */,
562562
86BBA9071D5E040C00FE8F16 /* MarginAdjustable.swift in Sources */,

SwiftMessages/TopBottomAnimation.swift SwiftMessages/EdgeAnimation.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// TopBottomAnimation.swift
2+
// EdgeAnimation.swift
33
// SwiftMessages
44
//
55
// Created by Timothy Moose on 6/4/17.
@@ -24,9 +24,9 @@ public class EdgeAnimation: NSObject, Animator {
2424

2525
public let style: Style
2626

27-
open var showDuration: TimeInterval = 0.4
27+
open var showDuration: TimeInterval = 0.35
2828

29-
open var hideDuration: TimeInterval = 0.2
29+
open var hideDuration: TimeInterval = 0.25
3030

3131
open var springDamping: CGFloat = 0.8
3232

@@ -65,7 +65,7 @@ public class EdgeAnimation: NSObject, Animator {
6565
NotificationCenter.default.removeObserver(self)
6666
let view = context.messageView
6767
self.context = context
68-
UIView.animate(withDuration: hideDuration, delay: 0, options: [.beginFromCurrentState, .curveEaseIn], animations: {
68+
UIView.animate(withDuration: hideDuration, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0, options: [.beginFromCurrentState]) {
6969
switch self.style {
7070
case .top:
7171
view.transform = CGAffineTransform(translationX: 0, y: -view.frame.height)
@@ -76,14 +76,14 @@ public class EdgeAnimation: NSObject, Animator {
7676
case .trailing:
7777
view.transform = CGAffineTransform(translationX: view.frame.maxX + view.frame.width, y: 0)
7878
}
79-
}, completion: { completed in
79+
} completion: { completed in
8080
#if SWIFTMESSAGES_APP_EXTENSIONS
8181
completion(completed)
8282
#else
8383
// Fix #131 by always completing if application isn't active.
8484
completion(completed || UIApplication.shared.applicationState != .active)
8585
#endif
86-
})
86+
}
8787
}
8888

8989
func install(context: AnimationContext) {

0 commit comments

Comments
 (0)