Skip to content

Commit dd72e4b

Browse files
committed
Use internal as access control level for TaskQueue code
1 parent d8c70ac commit dd72e4b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Source/TaskQueue.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
// alterations made to better cater for the PusherSwift use case
3333
//
3434

35-
open class TaskQueue: CustomStringConvertible {
35+
internal class TaskQueue: CustomStringConvertible {
3636
public typealias ClosureNoResultNext = () -> Void
3737
public typealias ClosureWithResultNext = (Any? , @escaping (Any?) -> Void) -> Void
3838

39-
open var tasks = [ClosureWithResultNext]()
40-
open lazy var completions = [ClosureNoResultNext]()
39+
internal var tasks = [ClosureWithResultNext]()
40+
internal lazy var completions = [ClosureNoResultNext]()
4141

4242
fileprivate(set) var numberOfActiveTasks = 0
43-
open var maximumNumberOfActiveTasks = 1 {
43+
internal var maximumNumberOfActiveTasks = 1 {
4444
willSet {
4545
assert(maximumNumberOfActiveTasks > 0, "Setting less than 1 task at a time is not allowed")
4646
}
@@ -51,22 +51,22 @@ open class TaskQueue: CustomStringConvertible {
5151

5252
fileprivate(set) var running = false
5353

54-
open var paused: Bool = false {
54+
internal var paused: Bool = false {
5555
didSet {
5656
running = !paused
5757
}
5858
}
5959

6060
fileprivate var cancelled = false
61-
open func cancel() {
61+
internal func cancel() {
6262
cancelled = true
6363
}
6464

6565
fileprivate var hasCompletions = false
6666

67-
public init() {}
67+
internal init() {}
6868

69-
open func run(_ completion: ClosureNoResultNext? = nil) {
69+
internal func run(_ completion: ClosureNoResultNext? = nil) {
7070
if completion != nil {
7171
hasCompletions = true
7272
completions += [completion!]
@@ -154,21 +154,21 @@ open class TaskQueue: CustomStringConvertible {
154154
}
155155
}
156156

157-
open func skip() {
157+
internal func skip() {
158158
if tasks.count>0 {
159159
_ = tasks.remove(at: 0)
160160
}
161161
}
162162

163-
open func removeAll() {
163+
internal func removeAll() {
164164
tasks.removeAll(keepingCapacity: false)
165165
}
166166

167-
open var count: Int {
167+
internal var count: Int {
168168
return tasks.count
169169
}
170170

171-
open func retry(_ delay: Double = 0) {
171+
internal func retry(_ delay: Double = 0) {
172172
assert(maximumNumberOfActiveTasks == 1, "You can only call retry() only on serial queues")
173173

174174
tasks.insert(currentTask!, at: 0)
@@ -180,7 +180,7 @@ open class TaskQueue: CustomStringConvertible {
180180
}
181181
}
182182

183-
open var description: String {
183+
internal var description: String {
184184
let state = running ? "runing " : (paused ? "paused ": "stopped")
185185
let type = maximumNumberOfActiveTasks == 1 ? "serial": "parallel"
186186

@@ -202,14 +202,14 @@ open class TaskQueue: CustomStringConvertible {
202202
//
203203
// Add a task closure with result and next params
204204
//
205-
public func += (tasks: inout [TaskQueue.ClosureWithResultNext], task: @escaping TaskQueue.ClosureWithResultNext) {
205+
internal func += (tasks: inout [TaskQueue.ClosureWithResultNext], task: @escaping TaskQueue.ClosureWithResultNext) {
206206
tasks += [task]
207207
}
208208

209209
//
210210
// Add a task closure that doesn't take result/next params
211211
//
212-
public func += (tasks: inout [TaskQueue.ClosureWithResultNext], task: @escaping TaskQueue.ClosureNoResultNext) {
212+
internal func += (tasks: inout [TaskQueue.ClosureWithResultNext], task: @escaping TaskQueue.ClosureNoResultNext) {
213213
tasks += [{ _, next in
214214
task()
215215
next(nil)

0 commit comments

Comments
 (0)