NetNewsWire/Mac/Inspector/NothingInspectorViewController.swift

48 lines
875 B
Swift
Raw Normal View History

2018-01-21 06:48:27 +01:00
//
// NothingInspectorViewController.swift
2018-08-29 07:18:24 +02:00
// NetNewsWire
2018-01-21 06:48:27 +01:00
//
// Created by Brent Simmons on 1/20/18.
// Copyright © 2018 Ranchero Software. All rights reserved.
//
import AppKit
2018-01-21 07:36:17 +01:00
final class NothingInspectorViewController: NSViewController, Inspector {
2018-01-21 06:48:27 +01:00
@IBOutlet var nothingTextField: NSTextField?
@IBOutlet var multipleTextField: NSTextField?
2018-01-21 07:36:17 +01:00
let isFallbackInspector = true
var objects: [Any]? {
didSet {
updateTextFields()
}
}
2018-01-21 07:36:17 +01:00
func canInspect(_ objects: [Any]) -> Bool {
return true
}
override func viewDidLoad() {
updateTextFields()
}
}
private extension NothingInspectorViewController {
func updateTextFields() {
2018-01-21 07:36:17 +01:00
if let objects = objects, objects.count > 1 {
nothingTextField?.isHidden = true
multipleTextField?.isHidden = false
}
else {
nothingTextField?.isHidden = false
multipleTextField?.isHidden = true
}
2018-01-21 07:36:17 +01:00
}
2018-01-21 06:48:27 +01:00
}