diff --git a/DXFeedFramework/Utils/Dictionary+Ext.swift b/DXFeedFramework/Utils/Dictionary+Ext.swift index e45b98ce6..355ebbeb3 100644 --- a/DXFeedFramework/Utils/Dictionary+Ext.swift +++ b/DXFeedFramework/Utils/Dictionary+Ext.swift @@ -33,3 +33,14 @@ public extension NSMutableOrderedSet { return changed } } + +public extension NSMutableSet { + func removeIf(using: NSPredicate) -> Bool { + var changed = false + for (value) in filtered(using: using) { + remove(value) + changed = true + } + return changed + } +} diff --git a/Samples/QuoteTableApp/MarketDepthViewController.swift b/Samples/QuoteTableApp/MarketDepthViewController.swift index e1a69846f..8d3d5f492 100644 --- a/Samples/QuoteTableApp/MarketDepthViewController.swift +++ b/Samples/QuoteTableApp/MarketDepthViewController.swift @@ -171,13 +171,9 @@ extension MarketDepthViewController: UITableViewDataSource { return UITableViewCell() } let order = orderBook.buyOrders[indexPath.row] - cell.update(price: order.price, - size: order.size, + cell.update(order: order, maxSize: maxBuy, - isAsk: true, - marketMaker: order.marketMaker, - source: order.eventSource, - scope: order.scope) + isAsk: true) cell.selectionStyle = UITableViewCell.SelectionStyle.none return cell } @@ -189,13 +185,9 @@ extension MarketDepthViewController: UITableViewDataSource { return UITableViewCell() } let order = orderBook.sellOrders[indexPath.row] - cell.update(price: order.price, - size: order.size, + cell.update(order: order, maxSize: maxSell, - isAsk: false, - marketMaker: order.marketMaker, - source: order.eventSource, - scope: order.scope) + isAsk: false) cell.selectionStyle = UITableViewCell.SelectionStyle.none return cell } diff --git a/Samples/QuoteTableApp/OrderCell.swift b/Samples/QuoteTableApp/OrderCell.swift index db6797d65..d201ca646 100644 --- a/Samples/QuoteTableApp/OrderCell.swift +++ b/Samples/QuoteTableApp/OrderCell.swift @@ -45,13 +45,15 @@ class OrderCell: UITableViewCell { sizeContentView.superview?.backgroundColor = .tableBackground } - func update(price: Double, - size: Double, + func update(order: Order, maxSize: Double, - isAsk: Bool, - marketMaker: String?, - source: IndexedEventSource, - scope: Scope) { + isAsk: Bool) { + let price = order.price + let size = order.size + let marketMaker = order.marketMaker + let source = order.eventSource + let scope = order.scope + priceLabel.text = formatter.string(from: NSNumber(value: price)) sizeLabel.text = formatter.string(from: NSNumber(value: size)) sizeContentView.backgroundColor = isAsk ? .green : .red