Methods with Special Names link in the documentation redirects to an undefined web page

I was going through the documentation for SwiftUI and in this page: Apple Developer Documentation, the "Methods with Special Names" link redirects to an undefined page with 404 error. It should redirect to this instead : Documentation


1 Like

Hey, you're absolutely right @mageshsridhar. There's a bug in our redirect code for anchors we haven't written out explicitly; I think we'll fix that sometime this week. Thanks for reporting this.


Here's the PR for this: Check that heading redirects exist in the remapping dictionary. by krilnon · Pull Request #102 · apple/swift-book · GitHub

Hey @krilnon, Thanks for quickly making a fix but I see that it now redirects to the homepage of the swift book instead of the page I linked. So is this like a temporary fix?

Yeah, I just wanted to get rid of the 404s for now. We'll map all of the old #ID622 anchors to their modern equivalents in a followup PR.

1 Like

Yes, this is only a partial fix. The current redirect JavaScript handles chapters only. (Technically, it includes about 3 section headings from the tour, as a proof of concept for the approach.) That's why I left GitHub issue #72 open.

There are about 650 anchors in TSPL for section headings that need to be mapped to their new URL. I matched up a lot of them last week by programmatically comparing the names of the Sphinx and DocC anchors; the remaining ones need to be added to the mapping table manually. I've got about 170 left to do, and then I'll open another PR. Here's the branch where I'm doing that work, if you'd like to follow along or make a PR: