-
Notifications
You must be signed in to change notification settings - Fork 475
Expand file tree
/
Copy pathInterfaceController.swift
More file actions
83 lines (65 loc) · 2.42 KB
/
InterfaceController.swift
File metadata and controls
83 lines (65 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// InterfaceController.swift
// watchOSDemo Extension
//
// Created by Dave Wood on 2015-09-09.
// Copyright © 2015 Cerebral Gardens. All rights reserved.
//
import WatchKit
import Foundation
import XCGLogger
let log: XCGLogger = {
// Setup XCGLogger
let log = XCGLogger.default
#if USE_NSLOG // Set via Build Settings, under Other Swift Flags
log.remove(destinationWithIdentifier: XCGLogger.Constants.baseConsoleDestinationIdentifier)
log.add(destination: AppleSystemLogDestination(identifier: XCGLogger.Constants.systemLogDestinationIdentifier))
log.logAppDetails()
#else
log.setup(level: .debug, showThreadName: true, showLevel: true, showFileNames: true, showLineNumbers: true)
#endif
return log
}()
class InterfaceController: WKInterfaceController {
override func awake(withContext context: Any?) {
// Display initial app info
_ = log
super.awake(withContext: context)
// Configure interface objects here.
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}
@IBAction func verboseButtonTapped(_ sender: WKInterfaceButton) {
log.verbose("Verbose tapped on the Watch")
}
@IBAction func debugButtonTapped(_ sender: WKInterfaceButton) {
log.debug("Debug tapped on the Watch")
}
@IBAction func infoButtonTapped(_ sender: WKInterfaceButton) {
log.info("Info tapped on the Watch")
}
@IBAction func noticeButtonTapped(_ sender: WKInterfaceButton) {
log.notice("Notice tapped on the Watch")
}
@IBAction func warningButtonTapped(_ sender: WKInterfaceButton) {
log.warning("Warning tapped on the Watch")
}
@IBAction func errorButtonTapped(_ sender: WKInterfaceButton) {
log.error("Error tapped on the Watch")
}
@IBAction func severeButtonTapped(_ sender: WKInterfaceButton) {
log.severe("Severe tapped on the Watch")
}
@IBAction func alertButtonTapped(_ sender: WKInterfaceButton) {
log.alert("Alert tapped on the Watch")
}
@IBAction func emergencyButtonTapped(_ sender: WKInterfaceButton) {
log.emergency("Emergency tapped on the Watch")
}
}