Skip to content

Commit 3a5d76d

Browse files
committed
Extract UISpringTimingParameters+DesignParams.swift
1 parent 9cc4420 commit 3a5d76d

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

FluidInterfaces/FluidInterfaces.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
BF3FF11B211C42C300EF8DF4 /* UISpringTimingParameters+DesignParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF3FF11A211C42C300EF8DF4 /* UISpringTimingParameters+DesignParams.swift */; };
1011
D806B89020F8275600740219 /* UIColorExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D806B88F20F8275600740219 /* UIColorExtensions.swift */; };
1112
D806B89220F82A3700740219 /* UIViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D806B89120F82A3700740219 /* UIViewExtensions.swift */; };
1213
D8409D0A20FBDA8100C7DCD2 /* CGPointExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8409D0920FBDA8100C7DCD2 /* CGPointExtensions.swift */; };
@@ -29,6 +30,7 @@
2930
/* End PBXBuildFile section */
3031

3132
/* Begin PBXFileReference section */
33+
BF3FF11A211C42C300EF8DF4 /* UISpringTimingParameters+DesignParams.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UISpringTimingParameters+DesignParams.swift"; sourceTree = "<group>"; };
3234
D806B88F20F8275600740219 /* UIColorExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColorExtensions.swift; sourceTree = "<group>"; };
3335
D806B89120F82A3700740219 /* UIViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewExtensions.swift; sourceTree = "<group>"; };
3436
D8409D0920FBDA8100C7DCD2 /* CGPointExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGPointExtensions.swift; sourceTree = "<group>"; };
@@ -98,6 +100,7 @@
98100
D806B89120F82A3700740219 /* UIViewExtensions.swift */,
99101
D806B88F20F8275600740219 /* UIColorExtensions.swift */,
100102
D8409D0920FBDA8100C7DCD2 /* CGPointExtensions.swift */,
103+
BF3FF11A211C42C300EF8DF4 /* UISpringTimingParameters+DesignParams.swift */,
101104
D8757E7520F124BD00D7EB4E /* Main.storyboard */,
102105
D8757E7820F124BF00D7EB4E /* Assets.xcassets */,
103106
D8757E7A20F124BF00D7EB4E /* LaunchScreen.storyboard */,
@@ -180,6 +183,7 @@
180183
D8976AB420F2B3A400E148CB /* InterfaceViewController.swift in Sources */,
181184
D806B89220F82A3700740219 /* UIViewExtensions.swift in Sources */,
182185
D806B89020F8275600740219 /* UIColorExtensions.swift in Sources */,
186+
BF3FF11B211C42C300EF8DF4 /* UISpringTimingParameters+DesignParams.swift in Sources */,
183187
D8976ABC20F2D3DC00E148CB /* Spring.swift in Sources */,
184188
D8757E7420F124BD00D7EB4E /* MenuViewController.swift in Sources */,
185189
D8409D0C20FC010B00C7DCD2 /* GradientView.swift in Sources */,

FluidInterfaces/FluidInterfaces/Spring.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,3 @@ class SliderView: UIView {
197197
}
198198

199199
}
200-
201-
extension UISpringTimingParameters {
202-
203-
/// A design-friendly way to create a spring timing curve.
204-
///
205-
/// - Parameters:
206-
/// - damping: The 'bounciness' of the animation. Value must be between 0 and 1.
207-
/// - response: The 'speed' of the animation.
208-
/// - initialVelocity: The vector describing the starting motion of the property. Optional, default is `.zero`.
209-
public convenience init(damping: CGFloat, response: CGFloat, initialVelocity: CGVector = .zero) {
210-
let stiffness = pow(2 * .pi / response, 2)
211-
let damp = 4 * .pi * damping / response
212-
self.init(mass: 1, stiffness: stiffness, damping: damp, initialVelocity: initialVelocity)
213-
}
214-
215-
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import UIKit
2+
3+
extension UISpringTimingParameters {
4+
5+
/// A design-friendly way to create a spring timing curve.
6+
///
7+
/// - Parameters:
8+
/// - damping: The 'bounciness' of the animation. Value must be between 0 and 1.
9+
/// - response: The 'speed' of the animation.
10+
/// - initialVelocity: The vector describing the starting motion of the property. Optional, default is `.zero`.
11+
public convenience init(damping: CGFloat, response: CGFloat, initialVelocity: CGVector = .zero) {
12+
let stiffness = pow(2 * .pi / response, 2)
13+
let damp = 4 * .pi * damping / response
14+
self.init(mass: 1, stiffness: stiffness, damping: damp, initialVelocity: initialVelocity)
15+
}
16+
17+
}

0 commit comments

Comments
 (0)