Hi Jesse,
Welcome to the Swift community!
You've got a great, although super broad question - let me share a little bit of how I approach these efforts, and I'm happy to provide more details if you're interested.
At the heart, there's a couple of questions I try to have pinned down (that's not always possible, but I try):
- who's the audience reading the docs - what do they know, what context do they have about what you're writing, and ideally what are after or trying to do with the content you're creating?
- Aligned closely with the above, what's the content you're creating trying to achieve?
There's various formalisms for the second here, but the general patterns are:
- tutorials
- how-to guides
- conceptual explanations
- reference
the four of these are labels put into the corners of a grid that line up with "trying to learn <----> trying to use" in one direction, and sort of the immediacy of the need "want to use the knowledge down the road" <----> "I need to solve a problem right now, how do I do this thing?"
Then there's some common goals that lean into based on where this all falls out.
Tutorials, for example, I try to line up a good, real example (surprisingly difficult) that's also simple enough. I aim for a single, clear path to follow (not diverging paths or alternatives) for a single narrative flow. Ideally it builds on pieces as it goes, and creates an easy to follow progression that both shows how to get something done, and touches on places where it explains as it's needed or most useful. I'll put variations or side paths in asides, but I try to almost ruthlessly prune those to keep things simple.
For how-to guides, I tend to start with a problem that's being solved, note down the moving parts that a developer needs to be aware of to achieve it, and pick a step-by-step path that lets me introduce concepts (if needed) in small chunks while working through the progression of the task being achieved. In my case, these are often short(er) articles, and the outline of the section headings reads like a "here are the steps to do this thing", with the detail inside the sections.
For me personally, the hardest part is teasing apart my own mental model, which is rarely as orderly as all this. I spend a bunch of time (when I'm trying to write) working through examples and verifying that what I think is correct actually is - and in some cases that's really hard. There's workarounds, optional side paths, choices in multiple ways to solve a problem, etc - all of which I try to nail down into something slightly more cohesive. I very frequently have to write a draft and then leave it alone and switch topics to something else for a day or two to get some distance between "what I know I said" and "what I actually wrote". It's incredibly difficult to spot what you missed, but intended to write, when it's super fresh in your head.
While I've written and published books in the past, I personally think there's a more value in shorter, focused content that doesn't take as long to assemble and publish. When I was publishing books (both through published and self-published), my general expectation was that anything I wrote was most useful for 3-6 months, generally useful for a year, and anything beyond 18 months was just good luck. That's all due to the rate of change in technologies.
When I'm tackling something like "documentation for a library", I have a mental checklist that I try to use:
- introduce the library and what it's helping you do
- make sure there's a quick path to getting it installed
- make sure there's a simple possible example of how it helps you do whatever it enables
- make sure there's clear reference API for the options that it has, and that all the public API has some description around it, especially functions/methods (since that's where most of the usage happens)
- organize the reference API so that the most common things are listed first, and organize any long lists of types or methods into smaller groupings that are easy to skim to find what you're trying to achieve.
Examples, frankly, are the hardest but most critical. I've run into some lovely API design that was just entirely opaque to my brain - I just didn't get it - until I saw an example of it being used, and then it clicked. So if when I'm doing project work like this, I try to iterate a LOT on the examples, and get as many established if there's multiple things that can be done. The more the better. These days, almost doubly so with the rise of agentic systems using the documentation and providing better results when the docs themselves have clear good practices and examples included within.
So that's a broad swath and brain dump. Let me know where I could help more, or what you're trying to work on and stumped with, if there's something more specific. You're welcome to reach out directly (DM me on these forums) if you'd like - I'm more than happy to help share what I've learned or share more specific pieces if it'd help.