Swift VFL grammar docs

The grammar for the Swift VFL language is described here: Auto Layout Guide: Visual Format Language

One of these vertical bars is not like the other!

And look at the parens here:

Screenshot 2024-07-06 at 1.27.17 PM

Here's the explanation:

Screenshot 2024-07-06 at 1.29.30 PM

I appreciate tremendously Apple's efforts to open source Swift, as well as their efforts in recent years to improve their documentation. Thank you so much!

But this is... not great. Using a very slightly different font size and shade to disambiguate character collisions in the set of literals vs the meta grammar adds unnecessary difficulty to understanding this grammar.

In fact, they are so similar in appearance that at first glance it simply appears to be a typesetting mistake.

Not to mention, this makes it impossible to create a plain-text copy of this grammar (i.e. as a comment within source code), as all of the colliding characters would appear identical.

Let's use this thread to brainstorm some ways to improve this!

1 Like

That documentation is actually for AppKit/UIKit APIs that are unrelated to Swift. But you could consider filing a feedback request if you think the documentation could be clarified!

2 Likes

Oh, interesting, is the VFL implemented entirely as a library? I thought for sure the Swift compiler would have to implement support for it in their parser.

Thanks for the link, I'll file a feedback request!

1 Like