Stop the Swift 2.0

July 29 2020 by Jeff Johnson

A couple weeks ago I introduced my new browser extension StopTheSwift, which forces Apple's online developer documentation to show Objective-C API instead of Swift. Since then, I've received a report that StopTheSwift wasn't working right on certain pages, such as StopTheSwift 1.0 simplemindedly added ?language=objc to the end of documentation URLs, but it turns out that sometimes there are different URL subpaths for Swift (uipasteboard/detectionpattern) and Objective-C (uipasteboarddetectionpattern).

This problem is solved, hopefully, in StopTheSwift 2.0. I added an ugly hack: StopTheSwift now checks whether Objective-C is selected in the Language popup, and toggles the popup if it isn't. Unfortunately, the popup isn't reliably available on the page in either DOMContentLoaded or load, so I just poll every second for up to 5 seconds. As I said, an ugly hack, but effective.

My motto is, if you can't join them (Apple), beat them!

Jeff Johnson (My apps, PayPal.Me)