Skip to content

Commit 7edbcb2

Browse files
committed
1. Delete SptingWorker
2. Delete OptionsWorker 3. Set delay to 0 as default value 4. Reset PickerView with options
1 parent 76807ae commit 7edbcb2

File tree

9 files changed

+15
-50
lines changed

9 files changed

+15
-50
lines changed

SpringApp.xcodeproj/project.pbxproj

-8
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@
2121
A86038E1280AD7BB0058D49E /* Animation.swift in Sources */ = {isa = PBXBuildFile; fileRef = A86038E0280AD7BB0058D49E /* Animation.swift */; };
2222
A86038E9280ADEAA0058D49E /* SpringAnimation in Frameworks */ = {isa = PBXBuildFile; productRef = A86038E8280ADEAA0058D49E /* SpringAnimation */; };
2323
A86038EF280AE2410058D49E /* SpringPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A86038EA280AE2410058D49E /* SpringPresenter.swift */; };
24-
A86038F0280AE2410058D49E /* SpringWorker.swift in Sources */ = {isa = PBXBuildFile; fileRef = A86038EB280AE2410058D49E /* SpringWorker.swift */; };
2524
A86038F1280AE2410058D49E /* SpringRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A86038EC280AE2410058D49E /* SpringRouter.swift */; };
2625
A86038F2280AE2410058D49E /* SpringModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = A86038ED280AE2410058D49E /* SpringModels.swift */; };
2726
A86038F3280AE2410058D49E /* SpringInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = A86038EE280AE2410058D49E /* SpringInteractor.swift */; };
2827
A8603909280C36070058D49E /* OptionsPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8603903280C36070058D49E /* OptionsPresenter.swift */; };
29-
A860390A280C36070058D49E /* OptionsWorker.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8603904280C36070058D49E /* OptionsWorker.swift */; };
3028
A860390B280C36070058D49E /* OptionsRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8603905280C36070058D49E /* OptionsRouter.swift */; };
3129
A860390C280C36070058D49E /* OptionsModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8603906280C36070058D49E /* OptionsModels.swift */; };
3230
A860390D280C36070058D49E /* OptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8603907280C36070058D49E /* OptionsViewController.swift */; };
@@ -50,12 +48,10 @@
5048
A86038E0280AD7BB0058D49E /* Animation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Animation.swift; sourceTree = "<group>"; };
5149
A86038E7280ADEA30058D49E /* SpringAnimation */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = SpringAnimation; sourceTree = "<group>"; };
5250
A86038EA280AE2410058D49E /* SpringPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpringPresenter.swift; sourceTree = "<group>"; };
53-
A86038EB280AE2410058D49E /* SpringWorker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpringWorker.swift; sourceTree = "<group>"; };
5451
A86038EC280AE2410058D49E /* SpringRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpringRouter.swift; sourceTree = "<group>"; };
5552
A86038ED280AE2410058D49E /* SpringModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpringModels.swift; sourceTree = "<group>"; };
5653
A86038EE280AE2410058D49E /* SpringInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpringInteractor.swift; sourceTree = "<group>"; };
5754
A8603903280C36070058D49E /* OptionsPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionsPresenter.swift; sourceTree = "<group>"; };
58-
A8603904280C36070058D49E /* OptionsWorker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionsWorker.swift; sourceTree = "<group>"; };
5955
A8603905280C36070058D49E /* OptionsRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionsRouter.swift; sourceTree = "<group>"; };
6056
A8603906280C36070058D49E /* OptionsModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionsModels.swift; sourceTree = "<group>"; };
6157
A8603907280C36070058D49E /* OptionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionsViewController.swift; sourceTree = "<group>"; };
@@ -141,7 +137,6 @@
141137
A86038C6280ACEB40058D49E /* SpringViewController.swift */,
142138
A86038EE280AE2410058D49E /* SpringInteractor.swift */,
143139
A86038EA280AE2410058D49E /* SpringPresenter.swift */,
144-
A86038EB280AE2410058D49E /* SpringWorker.swift */,
145140
A86038EC280AE2410058D49E /* SpringRouter.swift */,
146141
A86038ED280AE2410058D49E /* SpringModels.swift */,
147142
);
@@ -179,7 +174,6 @@
179174
A8603907280C36070058D49E /* OptionsViewController.swift */,
180175
A8603908280C36070058D49E /* OptionsInteractor.swift */,
181176
A8603903280C36070058D49E /* OptionsPresenter.swift */,
182-
A8603904280C36070058D49E /* OptionsWorker.swift */,
183177
A8603905280C36070058D49E /* OptionsRouter.swift */,
184178
A8603906280C36070058D49E /* OptionsModels.swift */,
185179
);
@@ -265,7 +259,6 @@
265259
A85E83E2280DA79E00FB6B82 /* CodePresenter.swift in Sources */,
266260
A85E83E4280DA79E00FB6B82 /* CodeRouter.swift in Sources */,
267261
A86038F1280AE2410058D49E /* SpringRouter.swift in Sources */,
268-
A860390A280C36070058D49E /* OptionsWorker.swift in Sources */,
269262
A860390D280C36070058D49E /* OptionsViewController.swift in Sources */,
270263
A860390B280C36070058D49E /* OptionsRouter.swift in Sources */,
271264
A85E83E7280DA79E00FB6B82 /* CodeInteractor.swift in Sources */,
@@ -279,7 +272,6 @@
279272
A86038F2280AE2410058D49E /* SpringModels.swift in Sources */,
280273
A8603909280C36070058D49E /* OptionsPresenter.swift in Sources */,
281274
A86038C5280ACEB40058D49E /* SceneDelegate.swift in Sources */,
282-
A86038F0280AE2410058D49E /* SpringWorker.swift in Sources */,
283275
);
284276
runOnlyForDeploymentPostprocessing = 0;
285277
};

SpringApp/Code/CodePresenter.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class CodePresenter: CodePresentationLogic {
3232
if response.animation.duration != 0.7 {
3333
codeText += String(format: " view.duration = %.1f\n", response.animation.duration)
3434
}
35-
if response.animation.delay != 1 {
35+
if response.animation.delay != 0 {
3636
codeText += String(format: " view.delay = %.1f\n", response.animation.delay)
3737
}
3838
if response.animation.damping != 0.7 {

SpringApp/Models/Animation.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct Animation {
1212
var curve = "easeIn"
1313
var force = 1.0
1414
var duration = 0.7
15-
var delay = 1.0
15+
var delay = 0.0
1616

1717
var damping = 0.7
1818
var velocity = 0.7

SpringApp/Options/OptionsInteractor.swift

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ protocol OptionsDataStore {
2929
class OptionsInteractor: OptionsBusinessLogic, OptionsDataStore {
3030

3131
var presenter: OptionsPresentationLogic?
32-
var worker: OptionsWorker?
3332
var animation: Animation?
3433
var delegate: SpringDataStore?
3534

SpringApp/Options/OptionsWorker.swift

-17
This file was deleted.

SpringApp/Spring/SpringInteractor.swift

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ protocol SpringDataStore {
3030
class SpringInteractor: SpringBusinessLogic, SpringDataStore {
3131

3232
var presenter: SpringPresentationLogic?
33-
var worker: SpringWorker?
3433
var animation: Animation?
3534
var animations = AnimationPreset.allCases
3635
var animationCurves = AnimationCurve.allCases

SpringApp/Spring/SpringViewController.swift

+12-4
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ class SpringViewController: UIViewController {
2020
@IBOutlet var delaySlider: UISlider!
2121
@IBOutlet var durationSlider: UISlider!
2222
@IBOutlet var forceSlider: UISlider!
23+
24+
@IBOutlet var pickerView: UIPickerView!
25+
2326
@IBOutlet var springView: SpringView!
2427

2528
var interactor: SpringBusinessLogic?
2629
var router: (NSObjectProtocol & SpringRoutingLogic & SpringDataPassing)?
2730

2831
private var request = SpringRequest()
2932

30-
private let animations = AnimationPreset.allCases
31-
private let animationCurves = AnimationCurve.allCases
33+
private let animations = AnimationPreset.allCases.map { $0.rawValue }
34+
private let curves = AnimationCurve.allCases.map { $0.rawValue }
3235

3336
// MARK: Object lifecycle
3437
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
@@ -103,6 +106,11 @@ extension SpringViewController: SpringDisplayLogic {
103106
durationLabel.text = viewModel.durationText
104107
delayLabel.text = viewModel.delayText
105108

109+
let animationIndex = animations.firstIndex(of: viewModel.animation) ?? 0
110+
let curveIndex = curves.firstIndex(of: viewModel.curve) ?? 0
111+
pickerView.selectRow(animationIndex, inComponent: 0, animated: false)
112+
pickerView.selectRow(curveIndex, inComponent: 1, animated: false)
113+
106114
springView.animation = viewModel.animation
107115
springView.curve = viewModel.curve
108116
springView.force = viewModel.force
@@ -126,11 +134,11 @@ extension SpringViewController: UIPickerViewDataSource, UIPickerViewDelegate {
126134
}
127135

128136
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
129-
component == 0 ? animations.count : animationCurves.count
137+
component == 0 ? animations.count : curves.count
130138
}
131139

132140
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
133-
component == 0 ? animations[row].rawValue : animationCurves[row].rawValue
141+
component == 0 ? animations[row] : curves[row]
134142
}
135143

136144
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {

SpringApp/Spring/SpringWorker.swift

-17
This file was deleted.

SpringApp/StoryBoards/Base.lproj/Main.storyboard

+1
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@
184184
<outlet property="durationSlider" destination="XYn-vA-cnQ" id="CdI-VS-cSa"/>
185185
<outlet property="forceLabel" destination="Cgb-SW-aoM" id="kMb-Oq-vAu"/>
186186
<outlet property="forceSlider" destination="6cl-on-gml" id="c5P-2h-QAz"/>
187+
<outlet property="pickerView" destination="LIa-2m-ZAi" id="Pi2-87-wZC"/>
187188
<outlet property="springView" destination="3aD-n6-FW6" id="gpq-rj-AwY"/>
188189
</connections>
189190
</viewController>

0 commit comments

Comments
 (0)