Posts Tagged “Cocoa”
I just released a new version of SafariSource which supports Safari 3.0 last night. This morning I received a Czech localization from Jakub Formanek, so I just released SafariSource v1.7.1. with the new localization.
So if you’re using Safari 3.0, or if you’re Czech, go ahead and download SafariSource. If you’re using Safari 2.x, please let me know it still works as I can’t test that with 3.0 installed.
Update: This code was written pre-Leopard, and as such doesn’t run under ObjC 2. See JRSwizzle for an updated version that runs under Leopard and Snow Leopard.
Method Swizzling is one common technique of people writing hacks, such as Safari Plugins.
Unfortunately, it’s always suffered from a flaw, wherein swizzling inherited methods affects all
classes which inherit that method (including the base class), rather than the intended subclass.
This problem is discussed on the CocoaDev Method Swizzling page.
As part of writing YubNubSearch, I decided to solve this problem.
First I looked into dynamic subclass generation + posing. Unfortunately, this has a big problem. In
this technique, calling the original implementation would naturally be done through a
[super foo] call.
Unfortunately, when the compiler sees
super, it hardcodes a reference to the superclass at which to
start the search. This means you cannot write this code in, say, a category on NSObject, then pull up the IMP
into a dynamically-generated subclass and have it work. So that throws out that idea.
The other idea I had, which I eventually went with, was to copy inherited methods into the subclass that you
wish to swizzle, before swizzling. It turned out to be fairly easy, and still has the same semantics as the old,
flawed technique for calling the original implementation.
You can download my implementation here.
6 Comments »
I just polished up my SIMBL plugin for release. It’s called YubNubSearch and it
allows you to use YubNub as your default search engine in Safari.
You can get it here.
5 Comments »
(This post was adapted from an email I sent to Mike Solomon).
Objective-C has a method caching mechanism that optimizes for the case where
a small number of methods are called repeatedly on one (or more) objects of a
given class. This happens very often; for example, if you iterate over an array
to gather the results of performing an operation on each element, you’re going to
be calling the same method on a bunch of instances of the same class. And in fact
-[NSEnumerator nextObject] method itself will also be cached.
The fact that method caching exists is common knowledge. However, what isn’t generally
known is how that caching is implemented, and what it means for you if you want to
hack around on the internals of a class.
Read the rest of this entry »
Earlier today Yahoo! finally released Yahoo! Messenger for OS X 3.0 beta 1, with an incredibly positive reaction from the general public. This is the app that I’ve spent the last 8 months working on, and I’m really proud to have finally released our first public beta. Even if you don’t use the old client, you should check it out. It’s a 100% rewrite in Cocoa, with a brand new spiffy UI, Growl support, avatar support, and more.
19 Comments »
Chris Liscio just released the next major version of his application, FuzzMeasure Pro 2.0. I think congratulations for all his hard work are in order.
Last night I updated Notification Watcher to be a Universal binary. I also updated the project for Xcode 2.2. You can find it over at tildesoft.com.
On a side note, I really need to re-design tildesoft to actually look semi-decent. I’ve been meaning to do this for ages, but I am not a designer. Anybody have any ideas?
So, for a while now Colloquy has had 2 nice new things going for it:
- The ability to write plugins in F-Script
- An installation of Trac on the website
F-Script is pretty neat. It’s a Smalltalk-based language that lets you use the Cocoa frameworks to do some pretty nifty stuff. One of the best things about it is it lets me write Colloquy plugins that use the Cocoa frameworks without having to compile anything or relaunch Colloquy each time I want to test a new iteration of the plugin. It also lets me open up an F-Script console in Colloquy and play with it interactively.
Read the rest of this entry »