I wanted a simple function to resize an image to a desired height, while keeping proportions. Here’s what I came up with (based on Marco implementation): extension NSImage { func resizedImageTo(sourceImage: NSImage, newSize: NSSize) -> NSImage?{ if sourceImage.isValid == false { …
Author Archives: mmv
Change Background Color of your app Title Bar
Subclass your NSWindow Controller, then in Window Did Load add the following two lines: //Signature Color window?.titlebarAppearsTransparent = true window?.backgroundColor = NSColor.blue That’s it, here’s the result you’ll get: Comments / questions? I’m at @MarcMasVi Marc
NSWindow min and max size (Swift 4)
You can force the views to keep a inferred min and max width/height by using AutoLayout, but what if you’re working with several views simultaneously? Wouldn’t it be simpler to have a window min and max width/height? Just add the following in your NSWindowController: override func windowDidLoad() { super.windowDidLoad() …
NSImageView Aspect Fill
Setting an image to use AspectFill in iOS is trivial, you can set it by code or directly in storyboard. But how do you do it in macOS? In Cocoa/App Kit there is no property for that, you may scale it , but there is no option for AspectFill (or AspectFit for that matter). So, …
Open links in the Background
Here’s a quick tip on how to open a URL in the background or foreground depending on a user-set preference. if(openInBackgroundPreferenceSet == true){ NSWorkspace.shared.open([linkToOpen], withAppBundleIdentifier: nil, options: NSWorkspace.LaunchOptions.withoutActivation, additionalEventParamDescriptor: nil, launchIdentifiers: nil) }else{ NSWorkspace.shared.open(linkToOpen) } Questions / comments? I’m at @MarcMasVi …
How far ahead of Apple Maps is Google Maps?
Extremely good article explaining why Google Maps is ahead on many areas ahead of Apple maps. Worth your time: link Marc
Denarius 1.6 & the slippery bug
This last couple of months I’ve been hard at work on two new projects, the first of which will be released fairly soon! But, today I wanted to write about something else: CoreData Concurrency. Since the release of Denarius about a year ago I’ve been regularly improving the personal finance app with new features and, …
“MP3 is dead” missed the story, great article from Arment
Great article from Marco Arment on the news about the “death” of the MP3 format. Worth a read: https://marco.org/2017/05/15/mp3-isnt-dead Marc
Shoe Dog: A Memoir by the Creator of Nike
Just finished “Shoe Dog: A Memoir by the Creator of Nike” and it’s great: well written and refreshingly honest. Even if you’re not into business books, I believe this one is worth your time. Bill Gates could not have said it better in his book review: “Shoe Dog, Phil Knight’s memoir about creating Nike, is a …
Continue reading “Shoe Dog: A Memoir by the Creator of Nike”
Get Date Day, Month or Year in Swift 3.0
Just a quick update to show how to get Date Day, Month or Year in Swift 3 //Here I’m creating the calendar instance that we will operate with: let calendar = NSCalendar.init(calendarIdentifier: NSCalendar.Identifier.gregorian) //Now asking the calendar what month are we in today’s date: let currentMonthInt = (calendar?.component(NSCalendar.Unit.month, from: Date()))! //Now …