Xcode 4 Code Snippets ? Perhaps my favourite feature of Xcode 4 is the Code Snippets feature. It allows you to use common bits quickly in your code, instead of requiring you retype them over and over again.
For the longest time, to perform a search in Xcode I would take a standard, yet uninformed, approach by selecting a desired region in my code, copy it to the clipboard with Command-C and then perform a Command-Shift-F to find all instances of the search in my project. Cool.
Then after a while I actually looked at the bottom of the Edit –> Find menu. At the end of the list there is an item entitled “Use Selection for Find” and its shortcut is Command-E.
The beauty of this command is that it puts the search term in a separate location preserving the contents of your clipboard.
This is particularly nice since now I can have text in my clipboard and still perform a search – a bit like having your cake and eating it too.
One of the more annoying things about iOS is its notification system. Modal alerts are so arcane, intrusive and annoying, I am actually shocked that they are still the standard method of notification in iOS as of version 4…
Looks like there are some underground movements (requiring jailbreaking, of course) to change that. Here’s a little commentary by Sebastiaan de With (@cocoia) that I found interesting:
There’s some discussion on Apple-centric and tech news websites about a video that’s doing the rounds with a new approach to notifications for iOS. While the system in the video is really nothing new (there’s been at least one alternative notification system in the App-Store-for-jailbroken-phones “Cydia” since 2010) it is getting a lot of attention, presumably because iOS users are quite satisfied with almost all the interactions of the OS except those dang stacking modal dialogs that interrupt your game of Angry Birds every time you get a text message.
So while I am not a jailbreaker (and never will be), my hope is that Apple and its designers and developers on the iOS team will take notice of this and do something about it in a future version of iOS.
Ten months ago when the original iPad shipped, Apple released iOS 3.2, and for the first time, iOS developers had access to NSAttributedString and NSMutableAttributedString, objects designed to hold strings along with font, paragraph, and style information. We no longer had to resort to using heavy UIWebViews or complex Core Graphics calls to draw styled text.
I ran into an interesting problem today. It was really basic and embarassing, so naturally I figured I’d go public with it…
Typically I use the alloc–initWithFormat–release way of creating strings, but today I used the NSString stringWithFormat factory method to generate a new NSString. Of course at the end of my method that was using the string I released the variable and it caused a mini-meltdown in the app I was working on.
So the new thing I found out today (and I guess I didn’t realize before) is that stringWithFormat returns an autoreleased NSString.