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
| MKMapRect zoomRect = MKMapRectNull; | |
| for (id <MKAnnotation> annotation in mapView.annotations) { | |
| MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate); | |
| MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0); | |
| if (MKMapRectIsNull(zoomRect)) { | |
| zoomRect = pointRect; | |
| } else { | |
| zoomRect = MKMapRectUnion(zoomRect, pointRect); | |
| } | |
| } |
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
| require 'mandrill' | |
| m = Mandrill::API.new 'myAPIKey' | |
| message = { | |
| :subject=> "Hello from the Mandrill API", | |
| :from_name=> "Your name", | |
| :text=>"Hi message, how are you?", | |
| :to=>[ | |
| { | |
| :email=> "recipient@theirdomain.com", | |
| :name=> "Recipient1" |
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 { | |
| @IBOutlet var tableView: NSTableView! | |
| var data: [[String: String]]? | |
| 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 { | |
| override func windowDidLoad() { | |
| super.windowDidLoad() | |
| self.configureWindowAppearance() | |
| } | |
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 { | |
| // This variable will hold our colours | |
| var windowColor = NSColor(named: "WindowColor") { | |
| didSet { | |
| configureWindowAppearance() | |
| } | |
| } |
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() | |
| } |
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
| 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 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 |
OlderNewer