Uncategorized

NSRegularExpression

“Some people, when confronted with a problem, think ‘I know, I’ll use NSRegularExpression.’ Now they have three problems.” Regular expressions fill a controversial role in the programming world. Some find them impenetrably incomprehensible, thick with symbols and adornments, more akin to a practical joke than part of a reasonable code base. Others rely on their brevity and their power, wondering h... »

guard & defer

“We should do (as wise programmers aware of our limitations) our utmost best to … make the correspondence between the program (spread out in text space) and the process (spread out in time) as trivial as possible.” —Edsger W. Dijkstra, “Go To Considered Harmful” Recently, Swift 2.0 introduced two new control statements that aim to simplify and streamline the programs we write: guard and defer. Whi... »

Reader Submissions – New Year’s 2016

With 2015 behind us and the new year begun, it’s time again for an NSHipster tradition: reader submissions! As in year’s past, this installment is chock full of tips and tricks that can help ease your days working with Xcode, Swift, and Objective-C. Many thanks to Cédric Luthi, Josip Ćavar, Juraj Hilje, Kyle Van Essen, Luo Jie, Mathew Huusko V, Nicolás Jakubowski, Nolan O’Brien, Orta Therox,... »

UITextChecker

Make no mistake, a tiny keyboard on a slab of glass doesn’t always lend itself to perfect typing. Whether for accuracy or hilarity, anyone typing on an iOS device notices when autocorrect steps in to help out. You might not know, however, that UIKit includes a class to help you with your user’s typing inside your app. First introduced in iOS 3.2 (or should we call it iPhone OS 3.2, given the early... »

NSHipster Quiz #8

This year’s WWDC edition of the NSHipster Pub Quiz was held on June 14th, once again testing the assembled developers with questions both random and obscure. We’re enormously grateful to Realm, who hosted the quiz for the second year in a row, with delicious food and drink and enough tables to seat nearly two hundred contestants. Competition was as fierce as always. Laughs and groans were heard. A... »

[NSDate date] memory leak!

I once asked a question about how to detect memory leaks when app is running. Thanks for someone who points out that Instruments is the right tool for this purpose.   Unfortunately by using Instruments, no explicit memory leaks are detected. But I found a very bewildering problem. It seems [NSDate date] leaks 16 bytes memory on each call. I soon constructed a very simple app to verify this: - (voi... »

Cocoa + frameworks

I am a programmer but it has been sooooooooo long since I programmed anything with the App-Frameworks. I have noticed many methods are deprecated and the ususal formating that I knew has changed.   I want to get up and running with Objective-C and especially Cocoa, the basic frameworks. I just came from Lynda and her videos are outdated. I am now considering Safari Books Online but I need to get c... »

Making Autolayout respect NSWindow’s maxSize.width

So, I have some constraints set up in IB. I normally don’t do autolayout, but all seems to be working nicely. The only thing is this, I set my window to have a max width of about 800….and….   I have a NSTextfield (label) in the window. If the text being displayed gets to be too long, the window’s width grows automatically (so the label doesn’t truncate). I was a bit s... »

How to find all files in subdirectories with NSMetadataQuery?

I am trying to watch all sub-directories starting with my document package bundle on macOS, but I can only get NSMetadataQuery to report files in the immediate directory used for the scope. It does not do a recursive search.   I am trying to watch for a list of files and their download status contained within my file package (NSFileWrapper *) which is stored on iCloud Drive (or anywhere the local ... »

About TextEdit version 1.9

(1) Is TextEdit 1.9 the latest version? (2) Is there a Document Appilcation other than TextEdit? (3) Is it best to learn from TextEdit and build you own Document Application?   Presently I am taking a survey as to what may be available to develop a document application. The document application would be incorporated along side a spritekit view in the same window. It might be that the TextEdit Appl... »

  • 1
  • 2
Skip to toolbar