Skip to content

Commit bd985cb

Browse files
committed
Tidying up cases
1 parent 7816f1f commit bd985cb

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

NetworkingInOperations-Example/Data/Abstract/ConcurrentOperation.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@ class ConcurrentOperation<T>: Operation {
2020

2121
var completionHandler: (OperationCompletionHandler)?
2222

23-
// MARK: - Types
23+
// MARK: - State
2424

2525
enum State: String {
26-
case ready = "isReady",
27-
executing = "isExecuting",
28-
finished = "isFinished"
26+
case ready = "isReady"
27+
case executing = "isExecuting"
28+
case finished = "isFinished"
2929
}
3030

31-
// MARK: - Properties
32-
3331
var state = State.ready {
3432
willSet {
3533
willChangeValue(forKey: newValue.rawValue)
@@ -41,8 +39,6 @@ class ConcurrentOperation<T>: Operation {
4139
}
4240
}
4341

44-
// MARK: - Operation
45-
4642
override var isReady: Bool {
4743
return super.isReady && state == .ready
4844
}
@@ -55,11 +51,13 @@ class ConcurrentOperation<T>: Operation {
5551
return state == .finished
5652
}
5753

54+
// MARK: - Asynchronous
55+
5856
override var isAsynchronous: Bool {
5957
return true
6058
}
6159

62-
// MARK: - Control
60+
// MARK: - Start
6361

6462
override func start() {
6563
guard !isCancelled else {
@@ -74,6 +72,8 @@ class ConcurrentOperation<T>: Operation {
7472
main()
7573
}
7674

75+
// MARK: - Finish
76+
7777
func finish() {
7878
if isExecuting {
7979
state = .finished
@@ -88,6 +88,8 @@ class ConcurrentOperation<T>: Operation {
8888
}
8989
}
9090

91+
// MARK: - Cancel
92+
9193
override func cancel() {
9294
super.cancel()
9395

0 commit comments

Comments
 (0)