Skip to content

Commit 47e4585

Browse files
author
Robert Gummesson
committed
minor refactoring
1 parent c063325 commit 47e4585

3 files changed

Lines changed: 18 additions & 21 deletions

File tree

BuildTimeAnalyzer/AppDelegate.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ class AppDelegate: NSObject, NSApplicationDelegate {
1212
@IBOutlet weak var buildTimesMenuItem: NSMenuItem!
1313
@IBOutlet weak var alwaysInFrontMenuItem: NSMenuItem!
1414

15-
func applicationDidFinishLaunching(_ notification: Notification) {
16-
alwaysInFrontMenuItem.state = UserSettings.windowShouldBeTopMost ? NSOnState : NSOffState
17-
}
18-
1915
var viewController: ViewController? {
2016
return NSApplication.shared().mainWindow?.contentViewController as? ViewController
2117
}
2218

19+
func applicationDidFinishLaunching(_ notification: Notification) {
20+
alwaysInFrontMenuItem.state = UserSettings.windowShouldBeTopMost ? NSOnState : NSOffState
21+
}
22+
2323
func configureMenuItems(showBuildTimesMenuItem: Bool) {
2424
projectSelectionMenuItem.isEnabled = !showBuildTimesMenuItem
2525
buildTimesMenuItem.isEnabled = showBuildTimesMenuItem

BuildTimeAnalyzer/CompileMeasure.swift

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ struct CompileMeasure {
3434
init?(time: Double, rawPath: String, code: String, references: Int) {
3535
let untrimmedFilename = rawPath.characters.split(separator: "/").map(String.init).last
3636

37-
guard let filepath = rawPath.characters.split(separator: ":").map(String.init).first else { return nil }
38-
guard let filename = untrimmedFilename?.characters.split(separator: ":").map(String.init).first else { return nil }
37+
guard let filepath = rawPath.characters.split(separator: ":").map(String.init).first,
38+
let filename = untrimmedFilename?.characters.split(separator: ":").map(String.init).first else { return nil }
3939

4040
let locationString = String(rawPath.substring(from: filepath.endIndex).characters.dropFirst())
4141
let locations = locationString.characters.split(separator: ":").flatMap{ Int(String.init($0)) }
@@ -52,8 +52,8 @@ struct CompileMeasure {
5252
init?(rawPath: String, time: Double) {
5353
let untrimmedFilename = rawPath.characters.split(separator: "/").map(String.init).last
5454

55-
guard let filepath = rawPath.characters.split(separator: ":").map(String.init).first else { return nil }
56-
guard let filename = untrimmedFilename?.characters.split(separator: ":").map(String.init).first else { return nil }
55+
guard let filepath = rawPath.characters.split(separator: ":").map(String.init).first,
56+
let filename = untrimmedFilename?.characters.split(separator: ":").map(String.init).first else { return nil }
5757

5858
self.time = time
5959
self.code = ""
@@ -63,19 +63,16 @@ struct CompileMeasure {
6363
self.references = 1
6464
}
6565

66-
6766
subscript(column: Int) -> String {
68-
get {
69-
switch column {
70-
case 0:
71-
return timeString
72-
case 1:
73-
return fileInfo
74-
case 2:
75-
return "\(references)"
76-
default:
77-
return code
78-
}
67+
switch column {
68+
case 0:
69+
return timeString
70+
case 1:
71+
return fileInfo
72+
case 2:
73+
return "\(references)"
74+
default:
75+
return code
7976
}
8077
}
8178
}

BuildTimeAnalyzer/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class ViewController: NSViewController {
114114
statusTextField.stringValue = stateName
115115
cancelButton.isHidden = true
116116

117-
case .waiting():
117+
case .waiting:
118118
progressIndicator.isHidden = true
119119
progressIndicator.stopAnimation(self)
120120
statusTextField.stringValue = ProcessingState.waitingForBuildString

0 commit comments

Comments
 (0)