Skip to content

Commit

Permalink
add available macro for OrderSet(just for test)
Browse files Browse the repository at this point in the history
need refactoring for old versions
  • Loading branch information
kosyloa committed May 8, 2024
1 parent 89ba673 commit 5ac44b7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions DXFeedFramework/Extra/OrderSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ class OrderSet {
let limit = isDepthLimitUnbounded() ? .max : depthLimit

if #available(iOS 15.0, *) {
let sortComparator = OrderSortComparator(comparator: comparator)
let sorted = orders.sorted(using: sortComparator)

for (index, element) in sorted.enumerated() {
if index < limit {
snapshot.append(element)
if #available(macOS 12.0, *) {
let sortComparator = OrderSortComparator(comparator: comparator)
let sorted = orders.sorted(using: sortComparator)
for (index, element) in sorted.enumerated() {
if index < limit {
snapshot.append(element)
}
}
}
}
} else {
for (index, element) in orders.enumerated() {
if index < limit {
Expand All @@ -108,6 +109,7 @@ class OrderSet {
}
}

@available(macOS 12.0, *)
@available(iOS 15.0, *)
class OrderSortComparator: SortComparator {
typealias Compared = Order
Expand Down

0 comments on commit 5ac44b7

Please sign in to comment.