onnxruntime/samples/swift/SwiftMnist/AppDelegate.swift

41 lines
1.1 KiB
Swift

//
// AppDelegate.swift
// SwiftMnist
//
// Created by Miguel de Icaza on 6/1/20.
// Copyright © 2020 Miguel de Icaza. All rights reserved.
//
import Cocoa
import SwiftUI
var mnist = mnist_new()
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var window: NSWindow!
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Create the SwiftUI view that provides the window contents.
let contentView = ContentView()
// Create the window and set the content view.
window = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 540, height: 300),
styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
backing: .buffered, defer: false)
window.center()
window.setFrameAutosaveName("Main Window")
window.contentView = NSHostingView(rootView: contentView)
window.makeKeyAndOrderFront(nil)
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
}