Skip to content

Commit

Permalink
Remove #available and @available checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lickel committed Dec 20, 2022
1 parent eb87f45 commit a7828c1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 67 deletions.
1 change: 0 additions & 1 deletion Sources/Scheduler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ public final class QueueScheduler: DateScheduler {
/// - name: A name for the queue in the form of reverse domain.
/// - targeting: (Optional) The queue on which this scheduler's work is
/// targeted
@available(OSX 10.10, *)
public convenience init(
qos: DispatchQoS = .default,
name: String = "org.reactivecocoa.ReactiveSwift.QueueScheduler",
Expand Down
28 changes: 13 additions & 15 deletions Tests/ReactiveSwiftTests/ActionSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,25 +186,23 @@ class ActionSpec: QuickSpec {
action1.apply().start()
}

if #available(macOS 10.10, *) {
it("should not loop indefinitely") {
let condition = MutableProperty(1)
it("should not loop indefinitely") {
let condition = MutableProperty(1)

let action = Action<Void, Void, Never>(state: condition, enabledIf: { $0 == 0 }) { _, _ in
return .empty
}
let action = Action<Void, Void, Never>(state: condition, enabledIf: { $0 == 0 }) { _, _ in
return .empty
}

var count = 0
var count = 0

action.isExecuting.producer
.startWithValues { _ in
condition.value = 10
action.isExecuting.producer
.startWithValues { _ in
condition.value = 10

count += 1
expect(count) == 1
}
}
}
count += 1
expect(count) == 1
}
}

describe("completed") {
beforeEach {
Expand Down
9 changes: 1 addition & 8 deletions Tests/ReactiveSwiftTests/PropertySpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,7 @@ class PropertySpec: QuickSpec {
}

it("should not deadlock") {
let queue: DispatchQueue

if #available(macOS 10.10, *) {
queue = DispatchQueue.global(qos: .userInteractive)
} else {
queue = DispatchQueue.global(priority: .high)
}

let queue = DispatchQueue.global(qos: .userInteractive)
let setup = DispatchGroup()
let workers = DispatchGroup()

Expand Down
8 changes: 0 additions & 8 deletions Tests/ReactiveSwiftTests/QueueScheduler+Factory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ extension QueueScheduler {
let file = URL(string: file)?.lastPathComponent ?? "<unknown>"
let label = "reactiveswift:\(file):\(line)"

#if targetEnvironment(macCatalyst)
return QueueScheduler(name: label)
#else
if #available(OSX 10.10, iOS 8.0, *) {
return QueueScheduler(name: label)
} else {
return QueueScheduler()
}
#endif
}
}
8 changes: 1 addition & 7 deletions Tests/ReactiveSwiftTests/SchedulerSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,7 @@ class SchedulerSpec: QuickSpec {
describe("UIScheduler") {
func dispatchSyncInBackground(_ action: @escaping () -> Void) {
let group = DispatchGroup()

let globalQueue: DispatchQueue
if #available(*, OSX 10.10) {
globalQueue = DispatchQueue.global()
} else {
globalQueue = DispatchQueue.global(priority: .default)
}
let globalQueue = DispatchQueue.global()

globalQueue.async(group: group, execute: action)
group.wait()
Expand Down
16 changes: 2 additions & 14 deletions Tests/ReactiveSwiftTests/SignalProducerSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3087,13 +3087,7 @@ class SignalProducerSpec: QuickSpec {
var result: Result<Int, Never>?

let group = DispatchGroup()

let globalQueue: DispatchQueue
if #available(*, OSX 10.10) {
globalQueue = DispatchQueue.global()
} else {
globalQueue = DispatchQueue.global(priority: .default)
}
let globalQueue = DispatchQueue.global()

globalQueue.async(group: group, flags: []) {
result = producer.last()
Expand Down Expand Up @@ -3135,13 +3129,7 @@ class SignalProducerSpec: QuickSpec {
var result: Result<(), Never>?

let group = DispatchGroup()

let globalQueue: DispatchQueue
if #available(*, OSX 10.10) {
globalQueue = DispatchQueue.global()
} else {
globalQueue = DispatchQueue.global(priority: .default)
}
let globalQueue = DispatchQueue.global()

globalQueue.async(group: group, flags: []) {
result = producer.wait()
Expand Down
16 changes: 2 additions & 14 deletions Tests/ReactiveSwiftTests/SignalSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,7 @@ class SignalSpec: QuickSpec {

describe("interruption") {
it("should not send events after sending an interrupted event") {
let queue: DispatchQueue

if #available(macOS 10.10, *) {
queue = DispatchQueue.global(qos: .userInitiated)
} else {
queue = DispatchQueue.global(priority: .high)
}
let queue = DispatchQueue.global(qos: .userInitiated)

let (signal, observer) = Signal<Int, Never>.pipe()

Expand Down Expand Up @@ -362,16 +356,10 @@ class SignalSpec: QuickSpec {
}

it("should interrupt concurrently") {
let queue: DispatchQueue
let queue = DispatchQueue.global(qos: .userInitiated)
let counter = Atomic<Int>(0)
let executionCounter = Atomic<Int>(0)

if #available(macOS 10.10, *) {
queue = DispatchQueue.global(qos: .userInitiated)
} else {
queue = DispatchQueue.global(priority: .high)
}

let iterations = 1000
let group = DispatchGroup()

Expand Down

0 comments on commit a7828c1

Please sign in to comment.