Last active
April 21, 2022 18:13
-
-
Save gonsolo/dd83654c0180fdda424756a59a6f66ad to your computer and use it in GitHub Desktop.
Swift 4 macOS Window Hello World
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hello World Window macOS Swift 4: Creates an empty window | |
import AppKit | |
let nsapp = NSApplication.shared | |
let rect = NSMakeRect(0, 0, 200, 200) | |
if #available(macOS 10.10, *) { | |
let window = NSWindow(contentRect: rect, | |
styleMask: .fullSizeContentView, | |
backing: NSWindow.BackingStoreType.buffered, | |
defer: false) | |
window.makeKeyAndOrderFront(nil) | |
} | |
nsapp.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plist><dict/></plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TARGET=HelloWindow | |
all: $(TARGET) | |
t: test | |
test: $(TARGET) | |
./$(TARGET) | |
$(TARGET): $(TARGET).swift | |
swiftc -o $(TARGET) $(TARGET).swift | |
e: edit | |
edit: | |
vi $(TARGET).swift | |
c: clean | |
clean: | |
rm -f $(TARGET) *.o |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment