The NSObject class lies at the root of (almost) all classes we build and use as part of Cocoa programming. What does it actually do, though, and how does it do it? Today, I’m going to rebuild NSObject from scratch, as suggested by friend of the blog and occasional guest author Gwynne Raskind.
He goes through memory management, inheritance, performing selectors, etc. Most of the heavy lifting is done by the runtime. It’s really amazing to see how simple it is to make this. I know I’ve thought the source code for NSObject must some crazy magic.
An interesting project from Mattt to scaffold RESTful web services based on CoreData models using Rack.
# Rack::CoreData requires a Sequel connection to a database
DB = Sequel.connect(ENV['DATABASE_URL'] || "postgres://localhost:5432/coredata")
In summary:• AFIncrementalStore: *poof* no client code.• Rack::CoreData: *poof* no server code.
As I continue to dive into iOS development, I’m on the lookout for time saving Cocoa projects. Sam’s SSPullToRefresh is an easy, customizable way to add pull-to-refresh views like those made popular in Loren Brichter’s original Tweetie for iPhone app. SSPullToRefresh hides all the pulling and animating logic away, leaving you to implement what you care about – fetching and refreshing your view.
This is handy NSWindow subclass that lets you center the traffic lights (close, minimize, and zoom) or do custom drawing in the window’s title bar. INAppStoreWindow doesn’t use any private APIs, so it’s App Store friendly. It also supports ARC or non-ARC.
The custom drawing is really simple. You just give it a block:
Wynn caught up with Eloy Durán, creator of CocoaPods to talk about the project, MacRuby, and his favorite Objective-C libraries. Items mentioned in the show: Eloy Durán, Ruby developer and creator of CocoaPods. CocoaPods, “the best way to manage library dependencies in Objective-C projects.” CocoaPods uses a Podfile to specify project dependencies. Eloy aspires to […]
A good API wrapper should handle network transport, payload serialization/deserialization, and authentication, abstracting these details away in order to let the developer deal with the business domain of the API. Projects like Faraday, Requests, and others have made creating higher level wrappers much easier.
URLs are one of those things about the web that we often take for granted. As developers, we can request resources and send users to other destinations just by knowing a location on the Internet.
The mobile landscape is a bit different. While most mobile applications speak Web, consuming REST-ful APIs and other web resources, quite often they’re little silos of vertical, site or brand-specific functionality. Did you know that for iOS developers Apple makes it possible to register your own URL scheme, as in this Gowalla example:
As handy as these custom iOS URL schemes are in launching other applications, mobile developer Greg Pierce wants to the community to extend the idea of custom URL schemes and adopt a standard for inter-app communication. X-Callback-URL is a draft specification for one-way and two-way communication between mobile apps on iOS and looks like this:
scheme: The app’s custom URL scheme, terminology in the above example
host: Callback URLs are identified by a host value of x-callback-url
version: The X-Callback-URL spec version, currently 1.0
action: The action to perform in the target app. In this case, Terminology will perform a lookup action.
x-callback parameters: Optional. Not used in this example
action parameters: The parameters to pass to the executing action, “a good deal” in this example
This approach provides a robust way to not only launch an app, but also request that the app handle an action, which may or may not have a UI associated with it.
The real power of X-Callback-URLs lies in two-way inter-app communication. By using the x-callback parameters in the spec, we can ask the target app to call us back on our own URLs, even handling success and error scenarios. Sort of like custom HTTP headers, these callback parameters are identified with an x- namespace:
x-source : The friendly name of the source app calling the action. If the action in the target app requires user interface elements, it may be necessary to identify to the user the app requesting the action.
x-success : If the action in the target method is intended to return a result to the source app, the x-callback parameter should be included and provide a URL to open to return to the source app. On completion of the action, the target app will open this URL, possibly with additional parameters tacked on to return a result to the source app. If x-success is not provided, it is assumed that the user will stay in the target app on successful completion of the action.
x-error : URL to open if the requested action generates an error in the target app. This URL will be open with at least the parameters “errorCode=code&errorMessage=message. If x-error is not present, and a error occurs, it is assumed the target app will report the failure to the user and remain in the target app.
Here’s how you’d build a URL to allow your users to select some text in your app, choose a replacement in Terminology, and have to return back to your app.
It’s a very Merry Christmas for Mac developers. Rasmus Andersson has open sourced Kod, the “programmers’ editor for OS X.”
Built from the ground to feel like a native OS X app, Kod sports Chrome-style tear-off tabs and aims for full concurrency, taking advantage of additional CPU cores when loading files, performing syntax highlighting, and other intensive tasks.
Even with the provided integrated scripting environment powered by Node.js, perhaps the most impressive feature for the web geek is that Kod is fully themable using CSS3.
So if you’re still waiting on TextMate 2.0 and Vim or emacs isn’t your bag, then give Kod a try.
As of today’s date (Sunday – December 12nd, 2010) the Kickstarter project has 93 backers and has raised over $3000 dollars. Erik’s original goal was to raise $2222 (I’d love to know where that number came from) by December 16th, so that means this project “is on”, and awaits the release of the funding this Thursday on the 16th at 5:00pm EST.
Hubcap will leverage the GitHub API to display your activity feed, notifications, and inbox messages. It will also allow you to compose and send new messages, follow new people or projects, and read the news feed of individuals, organizations, or projects. Hubcap will be a Cocoa app written primarily in MacRuby.
Erik tells us to expect to have an alpha version completed in April 2011, with beta versions coming in the early summer and the 1.0 shipping in the fall. What’s the best part? Once the 1.0 ships, the source code will be made available on GitHub to everyone.
SimFinger is a screencasting tool from Loren Brichter aka @atebits, author of popular apps like Tweetie for the iPhone as well as the desktop. SimFinger is a Cocoa app for the Mac that adds some polish to your mobile app screencasts by providing:
A frame that sits on top of the simulator and adds shine and an iPhone 3G look
A halo around the pointer to indicate touch events
Ability to set the carrier text
Fake apps (and dock badge counts) so that your app isn’t so lonely on the home screen.
Notice that we say ‘mobile apps’ and not ‘iPhone’ or ‘Touch’ apps because a fork from @kreutz adds support for the PalmPre simulator.
Now you can be the mayor of your cube farm on Foursquare in style. FoursquareX is a sexy Foursquare client for Snow Leopard. Oh, and it’s open source, so go ahead and fork it and add your own features.