Save the view controllers size.

This commit is contained in:
Damiano Galassi committed 2019-08-07 15:21:43 +02:00
1 parent 106813d5e5
commit 0f122f6242
8 files changed
+90 -44

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
//
// ViewController.swift
// Subler
//
// Created by Damiano Galassi on 07/08/2019.
//
import Cocoa
class ViewController: NSViewController, NSWindowDelegate {
// MARK: - Interface Builder
@IBInspectable var autosave: String?
// MARK: - NSViewController
override func viewWillAppear() {
super.viewWillAppear()
guard let window = self.view.window, let saveName = autosave else { return }
window.delegate = self
window.setFrameUsingName(saveName)
}
// MARK: - NSWindowDelegate
func windowDidEndLiveResize(_ notification: Notification) {
guard let saveName = autosave else {
return
}
self.view.window?.saveFrame(usingName: saveName)
}
}