libui/redo/osxaltest/main.swift

36 lines
756 B
Swift
Raw Normal View History

// 31 july 2015
import Cocoa
var spaced = false
var firstvert = true
func appLaunched() {
var mainwin = Window()
mainwin.SetMargined(spaced)
mainwin.Show()
}
class appDelegate : NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(note: NSNotification) {
appLaunched()
}
func applicationShouldTerminateAfterLastWindowClosed(app: NSApplication) -> Bool {
return true
}
}
func main() {
spaced = Process.arguments.count > 1
var app = NSApplication.sharedApplication()
app.setActivationPolicy(NSApplicationActivationPolicy.Regular)
2015-08-07 14:07:53 -05:00
// NSApplication.delegate is weak; if we don't use the temporary variable, the delegate will die before it's used
var delegate = appDelegate()
app.delegate = delegate
app.run()
}
main()