Swift — Require classes implementing protocol to be subclasses of a certain class

Update. In the latest Swift version you can just write protocol TransmogrifiableView: NSView { func transmogrify() } , and this will enforce the conformer types to be either NSView, or a subclass of it. This means the compiler will “see” all members of NSView. Original answer There is a workaround by using associated types to … Read more

How to map a custom protocol to an application on the Mac?

I’ve not had occasion to use it, but some time ago I bookmarked OS X URL handler to open links to local files which is exactly what you’re looking for. The important part of the linked procedure is adding an appropriate CFBundleURLTypes to your application’s Info.plist that describes the scheme. The example given there looks … Read more