Skip to content

Commit

Permalink
Merge pull request #666 from valeriyvan/logCopyToClipboardClick
Browse files Browse the repository at this point in the history
Refactors logCopyToClipboardClick
  • Loading branch information
glouel authored Nov 20, 2018
2 parents 25cd4e3 + f0dc123 commit cdeea7b
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions Aerial/Source/Controllers/PreferencesWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1312,18 +1312,10 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo
}

@IBAction func logCopyToClipboardClick(_ sender: NSButton) {
guard !errorMessages.isEmpty else {
return
}
guard !errorMessages.isEmpty else { return }

let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .none
dateFormatter.timeStyle = .medium

var clipboard = ""
for log in errorMessages {
clipboard += dateFormatter.string(from: log.date) + " : " + log.message + "\n"
}
let clipboard = errorMessages.map { dateFormatter.string(from: $0.date) + " : " + $0.message}
.joined(separator: "\n")

let pasteBoard = NSPasteboard.general
pasteBoard.clearContents()
Expand Down

0 comments on commit cdeea7b

Please sign in to comment.