// // Goose.swift // DesktopDuck // // Created by neon443 on 06/10/2026. // import Foundation import Cocoa class Goose: NSViewController { var state: GooseState var gooseView: NSView init() { self.state = .idle self.gooseView = NSView(frame: .zero) super.init(nibName: nil, bundle: nil) self.view.frame = NSScreen.main!.frame setup() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func setup() { gooseView.translatesAutoresizingMaskIntoConstraints = false gooseView.frame = NSRect(x: 100, y: 100, width: 50, height: 50) self.view.addSubview(gooseView) let bodyView = NSImageView(image: NSImage(named: "body")!) gooseView.addSubview(bodyView) bodyView.translatesAutoresizingMaskIntoConstraints = false bodyView.rotate(byDegrees: 50) NSLayoutConstraint.activate([ bodyView.widthAnchor.constraint(equalToConstant: 50), bodyView.heightAnchor.constraint(equalToConstant: 50) ]) let neckView = NSImageView(image: NSImage(named: "body")!) gooseView.addSubview(neckView) neckView.translatesAutoresizingMaskIntoConstraints = false neckView.rotate(byDegrees: 90) neckView.frame = NSRect(x: 0, y: 0, width: 30, height: 30) NSLayoutConstraint.activate([ neckView.leftAnchor.constraint(equalTo: bodyView.leftAnchor), neckView.bottomAnchor.constraint(equalTo: bodyView.bottomAnchor), neckView.widthAnchor.constraint(equalToConstant: 30), neckView.heightAnchor.constraint(equalToConstant: 30) ]) bodyView.alphaValue = 0.5 neckView.alphaValue = 0.5 } } enum GooseState { case idle case wander case draggingMessage case draggingMouse case running case aggro }