NetNewsWire/Mac/Preferences/Accounts/AccountAddViewController.swift

86 lines
2.1 KiB
Swift
Raw Normal View History

2019-05-01 17:28:13 +02:00
//
// AccountAddViewController.swift
// NetNewsWire
//
// Created by Maurice Parker on 5/1/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import Cocoa
class AccountAddViewController: NSViewController {
@IBOutlet weak var tableView: NSTableView!
init() {
super.init(nibName: "AccountAdd", bundle: nil)
}
public required init?(coder: NSCoder) {
super.init(coder: coder)
}
override func viewDidLoad() {
super.viewDidLoad()
tableView.dataSource = self
tableView.delegate = self
}
}
// MARK: - NSTableViewDataSource
extension AccountAddViewController: NSTableViewDataSource {
func numberOfRows(in tableView: NSTableView) -> Int {
return 2
}
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
return nil
}
}
// MARK: - NSTableViewDelegate
extension AccountAddViewController: NSTableViewDelegate {
private static let cellIdentifier = NSUserInterfaceItemIdentifier(rawValue: "AccountCell")
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
if let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "Cell"), owner: nil) as? AccountAddTableCellView {
switch row {
case 0:
cell.accountNameLabel?.stringValue = NSLocalizedString("Local", comment: "Local")
cell.accountImageView?.image = AppImages.accountLocal
case 1:
cell.accountNameLabel?.stringValue = NSLocalizedString("Feedbin", comment: "Feedbin")
cell.accountImageView?.image = AppImages.accountFeedbin
default:
break
}
return cell
}
return nil
}
func tableViewSelectionDidChange(_ notification: Notification) {
// let selectedRow = tableView.selectedRow
// guard selectedRow != -1 else {
// return
// }
//
// let account = sortedAccounts[selectedRow]
//
// let controller = AccountDetailViewController(account: account)
// addChild(controller)
// controller.view.translatesAutoresizingMaskIntoConstraints = false
// detailView.addSubview(controller.view)
// detailView.rs_addFullSizeConstraints(forSubview: controller.view)
}
}