1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
silica-viewer/SilicaViewer/ViewController.swift

44 lines
1.5 KiB
Swift
Raw Normal View History

2020-03-10 14:23:54 -04:00
import Foundation
import Cocoa
import Quartz
2020-03-10 14:23:54 -04:00
class ViewController: NSViewController {
@IBOutlet weak var imageView: NSImageView!
@IBOutlet weak var loadingField: NSTextField!
override func viewDidLoad() {
imageView.setContentCompressionResistancePriority(
.defaultLow,
for: .horizontal)
2020-03-11 22:15:05 -04:00
imageView.setContentCompressionResistancePriority(
.defaultLow,
for: .vertical)
}
2020-03-10 14:23:54 -04:00
override func viewWillAppear() {
let document = self.view.window?.windowController?.document as? Document
2021-09-30 07:55:58 -04:00
DispatchQueue.main.async {
guard let image = document?.makeComposite() else {
//self.loadingField.stringValue = "Failed to load."
return
}
2021-09-30 07:55:58 -04:00
self.imageView.image = image
//self.loadingField.isHidden = true
2021-09-30 07:55:58 -04:00
}
}
override func prepare(for segue: NSStoryboardSegue, sender: Any?) {
if(segue.identifier == "showInfo") {
// TODO: there HAS to be a better way to pass the Document class along...
(segue.destinationController as! InfoViewController).document = self.view.window?.windowController?.document as? Document
2021-05-09 21:44:04 -04:00
} else if(segue.identifier == "showTimelapse") {
((segue.destinationController as! NSWindowController).contentViewController as! TimelapseViewController).document = self.view.window?.windowController?.document as? Document
}
2020-03-10 14:23:54 -04:00
}
}