|
Bogdan Timofte
authored
2 weeks ago
|
1
|
//
|
|
|
2
|
// AppDelegate.swift
|
|
|
3
|
// USB Meter
|
|
|
4
|
//
|
|
|
5
|
// Created by Bogdan Timofte on 01/03/2020.
|
|
|
6
|
// Copyright © 2020 Bogdan Timofte. All rights reserved.
|
|
|
7
|
//
|
|
|
8
|
|
|
|
9
|
import UIKit
|
|
|
10
|
|
|
|
11
|
//let btSerial = BluetoothSerial(delegate: BSD())
|
|
|
12
|
let appData = AppData()
|
|
|
13
|
enum Constants {
|
|
|
14
|
static let chartUnderscan: CGFloat = 0.5
|
|
|
15
|
static let chartOverscan: CGFloat = 1 - chartUnderscan
|
|
|
16
|
}
|
|
|
17
|
// MARK: Clock
|
|
|
18
|
|
|
|
19
|
// MARK: Debug
|
|
|
20
|
public func track(_ message: String = "", file: String = #file, function: String = #function, line: Int = #line ) {
|
|
|
21
|
let date = Date()
|
|
|
22
|
let calendar = Calendar.current
|
|
|
23
|
let hour = calendar.component(.hour, from: date)
|
|
|
24
|
let minutes = calendar.component(.minute, from: date)
|
|
|
25
|
let seconds = calendar.component(.second, from: date)
|
|
|
26
|
print("\(hour):\(minutes):\(seconds) - \(file):\(line) - \(function) \(message)")
|
|
|
27
|
}
|
|
|
28
|
|
|
|
29
|
@UIApplicationMain
|
|
|
30
|
class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
|
31
|
|
|
|
32
|
|
|
|
33
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
|
Bogdan Timofte
authored
a week ago
|
34
|
logRuntimeICloudDiagnostics()
|
|
Bogdan Timofte
authored
2 weeks ago
|
35
|
return true
|
|
|
36
|
}
|
|
|
37
|
|
|
Bogdan Timofte
authored
a week ago
|
38
|
private func logRuntimeICloudDiagnostics() {
|
|
|
39
|
#if DEBUG
|
|
|
40
|
let hasUbiquityIdentityToken = FileManager.default.ubiquityIdentityToken != nil
|
|
|
41
|
track("Runtime iCloud diagnostics: ubiquityIdentityTokenAvailable=\(hasUbiquityIdentityToken)")
|
|
|
42
|
#endif
|
|
|
43
|
}
|
|
|
44
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
45
|
// MARK: UISceneSession Lifecycle
|
|
|
46
|
|
|
|
47
|
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
|
|
|
48
|
// Called when a new scene session is being created.
|
|
|
49
|
// Use this method to select a configuration to create the new scene with.
|
|
|
50
|
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
|
|
|
51
|
}
|
|
|
52
|
|
|
|
53
|
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
|
|
|
54
|
// Called when the user discards a scene session.
|
|
|
55
|
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
|
|
|
56
|
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
|
|
|
57
|
}
|
|
|
58
|
}
|