No matter how clear and well written, naked code is never quite self-documenting. There is always a role for comments, whether the in-line narration of key design points or the formal annotation of public declarations. Nearly every modern language, including Swift, offers some kind of structured comment system that documents APIs for developers that consume them.
The Swift structured documentation uses a mix of custom keywords and Markdown syntax to create a simple, easy-to-apply annotation tool. By leveraging this industry-standard tech, Apple opens up its structured documentation system to an entirely new generation with an absolute minimum of training needed to get up to speed.
This short book introduces Swift's documentation markup system using simple, illustrated examples, with plenty of discussion of best practices. You'll discover the components that make up Swift's structured comment system and learn how to best integrate them into your own code. For the most part, I've built this material out of examples from Swift's standard library, from release notes, and by reverse-engineering extensible style-sheet specifications. While I've tried to include a thorough list of legal tokens, I've focused on supplementing core details with a thoughtful discussion of best practices that will stand the test of time as Apple updates this system.
I hope you find this book to be a useful and worthy addition to your development library. I've had a great time writing it. Hopefully you'll have a great time reading it. Thank you for purchasing a copy!
-- Erica Sadun
What people are saying:
"I wish every line of #swiftlang I read in the future will be written by someone who reads the awesome [book] by @ericasadun" -- Mark Engle, @_markengle
"Just bought @ericasadun's #swiftlang Docs Markup Book. It's great for Swift devs" -- @Kametrixom
"Erica Sadun's new book, Swift Documentation Markup, an Illustrated Tour, not only explains the importance of documentation, it also comprehensively details the breadth of Xcode’s markup support...Until I read the book, I had no real idea of just how powerful this support was. In a series of clearly written sections, Erica explains how to implement features such as text formatting, category keywords and even embedded images with real world demonstrations, examples of how Apple use them and recommendations on whether they should actually be used.
The ability to add rich content to documentation means that creating code comments now feels more of a creative process and there’s a certain satisfaction to option-clicking your carefully crafted function to see a beautifully formatted comment appear. This in itself is a incentive to start documenting properly...So, thanks to Erica, expect to see a massive improvement in my own code documentation from now on." -- Simon Gladman, @FlexMonkey
"instapurchase!" -- James O'Leary, @jpohh
"Cool book on Xcode quick help comments by @ericasadun...Oh, and did I mention the book's cover is gorgeous?" -- @blessing_Lopes
"Every dev should have this!!!" -- Vic Hudson, @vichudson1
"Thanks for this!" -- Nick Kohrn, @bnkohrn
Customer ReviewsSee All
Practical, thorough, concise
Yes, okay, I suppose you could go rummaging around the in the scattered and inconstant Xcode documentation to understand the rapidly evolving standards of source code markup in Xcode.
But why would you? This book tis practical, through, and concise, and tells you eerything you need to know in a straightforward way. Worth it.
The best reference on this material.
I got started with “Swift Documentation” using the article with that title on NSHipster. This “book" covers the material there in a little more detail: my favorite feature is the assessing of how Apple has used each feature, in their own documentation. I plan to use this book as a reference until the documentation flows from me in such a way that the reference is unneeded.
My only quibble is that it would be easier to learn this material from as a playground, instead of an iBook.
A nice, thorough review of the topic
This is a good resource for Swift developers.