diff --git a/DXFeedFramework.xcodeproj/project.pbxproj b/DXFeedFramework.xcodeproj/project.pbxproj index 2d0407253..5910a2231 100644 --- a/DXFeedFramework.xcodeproj/project.pbxproj +++ b/DXFeedFramework.xcodeproj/project.pbxproj @@ -3083,7 +3083,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_TEAM = 485XM3FRHB; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Samples/QuoteTableApp/Info.plist; @@ -3117,7 +3117,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_TEAM = 485XM3FRHB; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Samples/QuoteTableApp/Info.plist; diff --git a/DXFeedFramework.xcodeproj/xcshareddata/xcschemes/DXQuoteTableApp.xcscheme b/DXFeedFramework.xcodeproj/xcshareddata/xcschemes/DXQuoteTableApp.xcscheme index c5292ed81..3ce323d33 100644 --- a/DXFeedFramework.xcodeproj/xcshareddata/xcschemes/DXQuoteTableApp.xcscheme +++ b/DXFeedFramework.xcodeproj/xcshareddata/xcschemes/DXQuoteTableApp.xcscheme @@ -30,7 +30,7 @@ shouldAutocreateTestPlan = "YES"> - - - + + + + @@ -26,7 +27,7 @@ - + @@ -35,7 +36,7 @@ - + @@ -127,86 +128,64 @@ - - - - - - - - - - + - - - + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + - + - - - + @@ -257,29 +236,29 @@ - - - - - - - + - + + + + + + + + - - + @@ -288,7 +267,7 @@ - + @@ -345,20 +324,6 @@ - - @@ -366,24 +331,18 @@ - - - - - - + - + - @@ -400,7 +359,6 @@ - diff --git a/Samples/QuoteTableApp/QuoteModel.swift b/Samples/QuoteTableApp/QuoteModel.swift index 85a497b05..47208e108 100644 --- a/Samples/QuoteTableApp/QuoteModel.swift +++ b/Samples/QuoteTableApp/QuoteModel.swift @@ -17,7 +17,7 @@ class QuoteModel { init() { formatter.minimumFractionDigits = 0 - formatter.maximumFractionDigits = 2 + formatter.maximumFractionDigits = 4 } var ask: String { diff --git a/Samples/QuoteTableApp/QuoteTableViewController.swift b/Samples/QuoteTableApp/QuoteTableViewController.swift index b053cf170..83fd11187 100644 --- a/Samples/QuoteTableApp/QuoteTableViewController.swift +++ b/Samples/QuoteTableApp/QuoteTableViewController.swift @@ -24,15 +24,26 @@ class QuoteTableViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() self.navigationController?.interactivePopGestureRecognizer?.delegate = self - titleLabel.textColor = .text self.view.backgroundColor = .tableBackground self.quoteTableView.backgroundColor = .clear quoteTableView.separatorStyle = .none + + NotificationCenter.default.addObserver(forName: .selectedSymbolsChanged, object: nil, queue: nil) { [weak self] (notification) in + guard let strongSelf = self else { + return + } + + strongSelf.loadQuotes() + } + loadQuotes() } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + } + + func loadQuotes() { let newSymbols = dataProvider.selectedSymbols if symbols != newSymbols { symbols = newSymbols @@ -44,7 +55,7 @@ class QuoteTableViewController: UIViewController { self.subscribe(false) } } - + func subscribe(_ unlimited: Bool) { if endpoint == nil { try? SystemProperty.setProperty(DXEndpoint.ExtraPropery.heartBeatTimeout.rawValue, "15s") diff --git a/Samples/QuoteTableApp/SymbolsDataProvider.swift b/Samples/QuoteTableApp/SymbolsDataProvider.swift index 1c94a01b3..7a30cd226 100644 --- a/Samples/QuoteTableApp/SymbolsDataProvider.swift +++ b/Samples/QuoteTableApp/SymbolsDataProvider.swift @@ -18,6 +18,11 @@ extension InstrumentInfo: Comparable { } } +extension Notification.Name { + static let selectedSymbolsChanged = Notification.Name("selectedSymbolsChanged") + +} + class SymbolsDataProvider { static let kSelectedSymbolsKey = "kSelectedSymbolsKey" static let kSymbolsKey = "kSymbolsKey" @@ -59,10 +64,12 @@ class SymbolsDataProvider { }) UserDefaults.standard.set(currentSymbols + newValues.sorted(), forKey: SymbolsDataProvider.kSelectedSymbolsKey) UserDefaults.standard.synchronize() + NotificationCenter.default.post(name: .selectedSymbolsChanged, object: nil) } func changeSymbols(_ symbols: [String]) { UserDefaults.standard.set(symbols, forKey: SymbolsDataProvider.kSelectedSymbolsKey) UserDefaults.standard.synchronize() + NotificationCenter.default.post(name: .selectedSymbolsChanged, object: nil) } } diff --git a/Samples/QuoteTableApp/SymbolsViewController.swift b/Samples/QuoteTableApp/SymbolsViewController.swift index c472e9e49..153e93822 100644 --- a/Samples/QuoteTableApp/SymbolsViewController.swift +++ b/Samples/QuoteTableApp/SymbolsViewController.swift @@ -9,7 +9,6 @@ import Foundation import UIKit class SymbolsViewController: UIViewController { - @IBOutlet var titleLabel: UILabel! @IBOutlet var symbolsTableView: UITableView! var dataProvider = SymbolsDataProvider() @@ -20,7 +19,6 @@ class SymbolsViewController: UIViewController { symbolsTableView.setEditing(true, animated: false) symbolsTableView.backgroundColor = .tableBackground symbolsTableView.separatorStyle = .none - titleLabel.textColor = .text view.backgroundColor = .tableBackground } @@ -36,7 +34,7 @@ class SymbolsViewController: UIViewController { } @IBAction func cancelTouchUpInside(_ sender: UIButton) { - self.dismiss(animated: true) + self.dismiss(animated: true) } }