This file contains hidden or 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
| # fly.toml app configuration file generated for part2 on 2024-02-24T19:58:21+01:00 | |
| # | |
| # See https://fly.io/docs/reference/configuration/ for information about how to use this file. | |
| # | |
| app = 'part2' | |
| primary_region = 'ams' | |
| [build] |
This file contains hidden or 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
| FROM swift:latest | |
| COPY Hello.swift /usr/src/app/ | |
| WORKDIR /usr/src/app/ | |
| RUN [ "swiftc", "Hello.swift", "-o", "Hello" ] | |
| ENTRYPOINT ["./Hello"] |
This file contains hidden or 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
| { | |
| "name": "Outdoor Gym", | |
| "coordinates": { | |
| "latitude": -22.988889, | |
| "longitude": 43.190556 | |
| }, | |
| "city": "Rio de Janiero", | |
| "country": "Brazil" | |
| } |
This file contains hidden or 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
| struct AddCityAndCountryToGymTableMigration: AsyncMigration { | |
| func prepare(on database: FluentKit.Database) async throws { | |
| try await database.schema("gyms") | |
| .field("city", .string) | |
| .field("country", .string) | |
| .update() | |
| } | |
| func revert(on database: FluentKit.Database) async throws { | |
| try await database.schema("gyms") |
This file contains hidden or 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
| class AppDelegate: NSObject, NSApplicationDelegate { | |
| lazy var mainWindowController = MainWindowController() | |
| func applicationDidFinishLaunching(_ aNotification: Notification) { | |
| // Insert code here to initialize your application | |
| mainWindowController.showWindow(nil) | |
| } | |
| func applicationWillTerminate(_ aNotification: Notification) { |
This file contains hidden or 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
| @objc dynamic var peopleArray: [Person] = [Person(firstName: "Ragnar", lastName: "Lothbrok", mobileNumber: "555-1234"), | |
| Person(firstName: "Bjorn", lastName: "Lothbrok", mobileNumber: "555-3412"), | |
| Person(firstName: "Harald", lastName: "Finehair", mobileNumber: "555-4512") | |
| ] |
This file contains hidden or 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
| import Foundation | |
| class Person: NSObject { | |
| @objc dynamic var firstName: String | |
| @objc dynamic var lastName: String | |
| @objc dynamic var mobileNumber: String | |
| init(firstName: String, lastName: String, mobileNumber: String) { | |
| self.firstName = firstName | |
| self.lastName = lastName |
This file contains hidden or 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
| private var window: NSWindow? | |
| func applicationDidFinishLaunching(_ aNotification: Notification) { | |
| let windowSize = NSSize(width: 480, height: 240) | |
| let screenSize = NSScreen.main?.frame.size ?? .zero | |
| let rect = NSMakeRect(screenSize.width/2 - windowSize.width/2, screenSize.height/2 - windowSize.height/2, windowSize.width, windowSize.height) | |
| window = NSWindow(contentRect: rect, styleMask: [.miniaturizable, .closable, .resizable, .titled], backing: .buffered, defer: false) | |
| window?.title = "No Storyboard Window" | |
| window?.makeKeyAndOrderFront(nil) |
This file contains hidden or 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
| import Cocoa | |
| class ViewController: NSViewController { | |
| private var appearanceChangeObservation: NSKeyValueObservation? | |
| @IBOutlet var imageView: NSImageView! | |
| override func viewDidLoad() { | |
| super.viewDidLoad() |
This file contains hidden or 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
| import Cocoa | |
| class CustomWindow: NSWindowController { | |
| @IBOutlet var modeIndicator: NSToolbarItem! | |
| var windowColor = NSColor(named: "WindowColor") { | |
| didSet { | |
| configureWindowAppearance() | |
| } |
NewerOlder