From f8623b803897d16c3609b42229a6bd224cf1c2e4 Mon Sep 17 00:00:00 2001 From: AKosylo Date: Fri, 8 Sep 2023 14:03:11 +0200 Subject: [PATCH] fix warning and change call methods with new signature --- Samples/IpfTableApp/AppDelegate.swift | 18 ++++---------- Samples/IpfTableApp/IpfCell.swift | 1 - Samples/IpfTableApp/SceneDelegate.swift | 24 +++---------------- Samples/IpfTableApp/ViewController.swift | 6 ++++- .../LatencyViewController.swift | 4 ++-- .../PertTestApp/PerfTestViewController.swift | 6 ++--- 6 files changed, 18 insertions(+), 41 deletions(-) diff --git a/Samples/IpfTableApp/AppDelegate.swift b/Samples/IpfTableApp/AppDelegate.swift index 1842bdaf2..5bf7e4ad0 100644 --- a/Samples/IpfTableApp/AppDelegate.swift +++ b/Samples/IpfTableApp/AppDelegate.swift @@ -10,27 +10,19 @@ import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { - - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. + func application(_ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { return true } // MARK: UISceneSession Lifecycle - func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { - // Called when a new scene session is being created. - // Use this method to select a configuration to create the new scene with. + func application(_ application: UIApplication, + configurationForConnecting connectingSceneSession: UISceneSession, + options: UIScene.ConnectionOptions) -> UISceneConfiguration { return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { - // Called when the user discards a scene session. - // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. - // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } - - } - diff --git a/Samples/IpfTableApp/IpfCell.swift b/Samples/IpfTableApp/IpfCell.swift index c72b24384..81cfd7e0b 100644 --- a/Samples/IpfTableApp/IpfCell.swift +++ b/Samples/IpfTableApp/IpfCell.swift @@ -7,7 +7,6 @@ import UIKit - class IpfCell: UITableViewCell { @IBOutlet var titleLabel: UILabel! @IBOutlet var counterLabel: UILabel! diff --git a/Samples/IpfTableApp/SceneDelegate.swift b/Samples/IpfTableApp/SceneDelegate.swift index 334664455..64901185a 100644 --- a/Samples/IpfTableApp/SceneDelegate.swift +++ b/Samples/IpfTableApp/SceneDelegate.swift @@ -11,42 +11,24 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? - - func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { - // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. - // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. - // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). - guard let _ = (scene as? UIWindowScene) else { return } + func scene(_ scene: UIScene, + willConnectTo session: UISceneSession, + options connectionOptions: UIScene.ConnectionOptions) { } func sceneDidDisconnect(_ scene: UIScene) { - // Called as the scene is being released by the system. - // This occurs shortly after the scene enters the background, or when its session is discarded. - // Release any resources associated with this scene that can be re-created the next time the scene connects. - // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). } func sceneDidBecomeActive(_ scene: UIScene) { - // Called when the scene has moved from an inactive state to an active state. - // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. } func sceneWillResignActive(_ scene: UIScene) { - // Called when the scene will move from an active state to an inactive state. - // This may occur due to temporary interruptions (ex. an incoming phone call). } func sceneWillEnterForeground(_ scene: UIScene) { - // Called as the scene transitions from the background to the foreground. - // Use this method to undo the changes made on entering the background. } func sceneDidEnterBackground(_ scene: UIScene) { - // Called as the scene transitions from the foreground to the background. - // Use this method to save data, release shared resources, and store enough scene-specific state information - // to restore the scene back to its current state. } - } - diff --git a/Samples/IpfTableApp/ViewController.swift b/Samples/IpfTableApp/ViewController.swift index 399751cec..d92c0ac35 100644 --- a/Samples/IpfTableApp/ViewController.swift +++ b/Samples/IpfTableApp/ViewController.swift @@ -75,13 +75,17 @@ extension ViewController: DXInstrumentProfileUpdateListener { } } DispatchQueue.main.async { - self.lastUpdateLabel.text = TimeUtil.toLocalDateString(millis: self.collector?.getLastUpdateTime() ?? 0) self.ipfList = self.buffer.map { _, value in value }.sorted(by: { ipf1, ipf2 in ipf1.symbol < ipf2.symbol }) self.ipfTableView.reloadData() + self.lastUpdateLabel.text = +""" +\(self.ipfList.count) profiles: \(TimeUtil.toLocalDateString(millis: self.collector?.getLastUpdateTime() ?? 0)) +""" + } } } diff --git a/Samples/LatencyTestApp/LatencyViewController.swift b/Samples/LatencyTestApp/LatencyViewController.swift index 820f4d460..2e65007aa 100644 --- a/Samples/LatencyTestApp/LatencyViewController.swift +++ b/Samples/LatencyTestApp/LatencyViewController.swift @@ -72,11 +72,11 @@ class LatencyViewController: UIViewController { return } endpoint = try? DXEndpoint.builder().withRole(.feed).build() - endpoint?.add(self) + endpoint?.add(observer: self) try? endpoint?.connect(address) subscription = try? endpoint?.getFeed()?.createSubscription(.timeAndSale) - try? subscription?.add(self) + try? subscription?.add(observer: self) try? subscription?.addSymbols(symbols) diagnostic.cleanTime() diff --git a/Samples/PertTestApp/PerfTestViewController.swift b/Samples/PertTestApp/PerfTestViewController.swift index 2c70470f6..e9dd73deb 100644 --- a/Samples/PertTestApp/PerfTestViewController.swift +++ b/Samples/PertTestApp/PerfTestViewController.swift @@ -125,13 +125,13 @@ class PerfTestViewController: UIViewController { return } endpoint = try? DXEndpoint.builder().withRole(.feed).build() - endpoint?.add(self) + endpoint?.add(observer: self) try? endpoint?.connect(address) subscription = try? endpoint?.getFeed()?.createSubscription(.timeAndSale) profileSubscription = try? endpoint?.getFeed()?.createSubscription(.profile) - try? subscription?.add(self) - try? profileSubscription?.add(self) + try? subscription?.add(observer: self) + try? profileSubscription?.add(observer: self) try? subscription?.addSymbols(symbols) try? profileSubscription?.addSymbols(symbols)