2 // ScreenshotDetailViewController.swift
5 // Created by Hori,Masaki on 2016/12/29.
6 // Copyright © 2016年 Hori,Masaki. All rights reserved.
11 final class ScreenshotDetailViewController: BridgeViewController {
13 @IBOutlet private var imageView: ImageView!
15 override var nibName: NSNib.Name {
17 return .nibName(instanceOf: self)
20 override var contentRect: NSRect {
22 return imageView.convert(imageView.imageRect, to: nil)
25 private var currentSelection: [ScreenshotInformation] = []
27 private var selectionObservation: NSKeyValueObservation?
29 override func viewDidLoad() {
33 selectionObservation = arrayController.observe(\NSArrayController.selectionIndexes) { [weak self] (_, _) in
35 self?.updateSelections()
41 private func updateSelections() {
43 guard let selection = arrayController.selectedObjects as? [ScreenshotInformation] else {
48 if currentSelection == selection {
53 imageView.images = selection.compactMap { NSImage(contentsOf: $0.url) }
54 currentSelection = selection