diff --git a/OTRS-Watch.xcodeproj/project.xcworkspace/xcuserdata/linnemann.xcuserdatad/UserInterfaceState.xcuserstate b/OTRS-Watch.xcodeproj/project.xcworkspace/xcuserdata/linnemann.xcuserdatad/UserInterfaceState.xcuserstate index fdd5423..4fac58b 100644 Binary files a/OTRS-Watch.xcodeproj/project.xcworkspace/xcuserdata/linnemann.xcuserdatad/UserInterfaceState.xcuserstate and b/OTRS-Watch.xcodeproj/project.xcworkspace/xcuserdata/linnemann.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/OTRS-Watch/Base.lproj/Main.storyboard b/OTRS-Watch/Base.lproj/Main.storyboard index 58500d8..6428c4e 100644 --- a/OTRS-Watch/Base.lproj/Main.storyboard +++ b/OTRS-Watch/Base.lproj/Main.storyboard @@ -760,7 +760,7 @@ - + @@ -918,7 +918,7 @@ - + @@ -1180,6 +1180,15 @@ + + + + + + + + + @@ -1188,6 +1197,7 @@ + diff --git a/OTRS-Watch/Extension/ViewControllerExtension.swift b/OTRS-Watch/Extension/ViewControllerExtension.swift index dba258a..afda35a 100644 --- a/OTRS-Watch/Extension/ViewControllerExtension.swift +++ b/OTRS-Watch/Extension/ViewControllerExtension.swift @@ -27,33 +27,34 @@ extension ViewController: NSTableViewDataSource, NSTableViewDelegate { var text: String = "" var cellIdentifier: String = "" - guard row < OTRS.sharedInstance.ticketDictionary.count, - let item:Ticket = OTRS.sharedInstance.ticketDictionary[row] else { + guard row < OTRS.sharedInstance.ticketDictionary.count else { return nil } - if tableColumn == self.ticketTableView.tableColumns[0] { - cellIdentifier = CellIdentifiers.OTRSTicketNumber - image = nil - text = item.created.timeAgo - } else if tableColumn == self.ticketTableView.tableColumns[1] { - cellIdentifier = CellIdentifiers.OTRSTicketDetails - image = nil - text = item.owner - } else if tableColumn == self.ticketTableView.tableColumns[2] { - cellIdentifier = CellIdentifiers.OTRSTicketDetails - image = nil - text = item.title - } else if tableColumn == self.ticketTableView.tableColumns[3] { - cellIdentifier = CellIdentifiers.OTRSTicketState - image = nil - text = item.state.rawValue - } - - if let cell = tableView.make(withIdentifier: cellIdentifier, owner: nil) as? NSTableCellView { - cell.textField?.stringValue = text - cell.imageView?.image = image ?? nil - return cell + if let item:Ticket = OTRS.sharedInstance.ticketDictionary[row] as Ticket { + if tableColumn == self.ticketTableView.tableColumns[0] { + cellIdentifier = CellIdentifiers.OTRSTicketNumber + image = nil + text = item.created.timeAgo + } else if tableColumn == self.ticketTableView.tableColumns[1] { + cellIdentifier = CellIdentifiers.OTRSTicketDetails + image = nil + text = item.owner + } else if tableColumn == self.ticketTableView.tableColumns[2] { + cellIdentifier = CellIdentifiers.OTRSTicketDetails + image = nil + text = item.title + } else if tableColumn == self.ticketTableView.tableColumns[3] { + cellIdentifier = CellIdentifiers.OTRSTicketState + image = nil + text = item.state.rawValue + } + + if let cell = tableView.make(withIdentifier: cellIdentifier, owner: nil) as? NSTableCellView { + cell.textField?.stringValue = text + cell.imageView?.image = image ?? nil + return cell + } } return nil diff --git a/OTRS-Watch/ViewController.swift b/OTRS-Watch/ViewController.swift index ec9bec0..703f1f1 100644 --- a/OTRS-Watch/ViewController.swift +++ b/OTRS-Watch/ViewController.swift @@ -26,11 +26,17 @@ class ViewController: NSViewController { @IBOutlet weak var txtTicketCreatedBy: NSTextField! @IBOutlet weak var txtTicketPriority: NSTextField! + @IBOutlet weak var lblVersion: NSTextField! + + override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. + if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String { + self.lblVersion.stringValue = version + } ticketTableView.delegate = self ticketTableView.dataSource = self