You Need to Document Your Swift Code with DocC

preview_player
Показать описание

I show you how to get Apple-like documentation and auto complete in your Swift and SwiftUI Codebases using DocC and Xcode. We use Xcode's Documentation Preview Editor to build our codebases documentation with descriptions, code samples and Important tags.

I also go on a short rant with my thoughts on code comments in general.

My iOS Dev Courses:

My Source Code:

X (Twitter):

Book and learning recommendations that help out the channel if you decide to purchase (Affiliate Links):

Mark Moeyken’s SwiftUI Books:

Paul Hudson's Hacking With Swift:

RocketSim - Enhance Your Xcode Simulator:

Timestamps:
0:00 - What is DocC?
1:21 - Rant on Code Comments
2:00 - Documenting our 1st Function
2:38 - Documentation Preview Editor
3:22 - Linking to Other Types
4:55 - Including Code Snippets
6:23 - Parameters & Important!
8:21 - Build Your Documentation

#swift #softwaredeveloper #iosdeveloper
Рекомендации по теме
Комментарии
Автор

Wow I just wrote down "learn ios documentation" on my todo list for my app and this video shows up today. Thanks!

austnsauce
Автор

This is really interesting. Having a strong background in ObjC\Cocoa I am very used to this Markdown style
The ONE thing that I will add is that you can ALSO do this with a foldable block-comments just starting with standard /** */ delimiters

kennvillegas
Автор

I get some heat sometimes at work for saying "There's no such thing as self-documenting code" but I stand by it. Your code may say what you're doing, but it can't tell why you're doing it and the why is the important part the comments need to cover. That being said I also don't accept uncommented pull requests. Too many people need to touch our code years from now, those comments are important.

sn
Автор

I love it this channel, i'm working as a Senior Flutter Developer but now i trying to change a little mi Stack with IOS and all about that, and this channel is perfect.

Thank you so much Mr. Allen

TheOneOverTheMood
Автор

Pro Tip: Ask Claude or GPT to add documentation for your code. It’s usually pretty great right away.

Extra pro tip, build your own gpt to use things like important/tip/warning/etc, also back ticks to improve your documentation

Didn’t know about the back ticks and the important bubbles till now! Sweet stuff 🙏🏼

dre
Автор

OMG THANK YOU. Never knew what DocC actually did until now. I'll be busy for the next few hours. 🙂

danuff
Автор

Thanks for telling me about the side-panel documentation preview!

darylewalker
Автор

Fantastic walkthrough! I just joined a new company that uses DocC and I've never dealt with it before so this is very timely 👌

DaveJacobseniOS
Автор

I’m new to coding, 👨🏼‍💻 and I’m so glad I found this because I comment the daylights out of my code. I think most of my pages are more comment than code.
I just wish there was a tool like this to write User Manuals for the finished app, not just the developer documentation 😭

KevKevAllen
Автор

please tutorial on airdrop usage in your app, great video as always

fg
Автор

Documentation is a great feature, i'm using from time to time to indicate some spicy stuff with warnings.

Stricken
Автор

Sean, you once apologised in a video for being 'anal', I for one appreciate your desire to make the code more readable. My code has grown to the extent where I would be spending more time on figuring out what my previous code did rather than spending that time to improve the app. I have taken a stab at DocC once but found myself wasting more time in trying to figure it all out; so thank you VERY MUCH for your videos on summarising these important tools. Like a previous poster said, your videos very often come out at EXACTLY the right time.😎👍

KuisebGecko
Автор

Thanks for the video! If you have a lot to document for a function, the inline documentation would get very large. Is there a way to bring this to a new file or hide it some way? Thank you!

RyanPhung
Автор

Nice vid on DocC. I didn’t know that you can do double ticks for the code links. 🙂

Quick question: Do you recommend also commenting the private structs, methods, et al., or only the ones that are “public”?

kris_torres
Автор

This is was a very impactful video. Thanks for sharing.

When you include code snippets (6:18) could you put them at the end of your file? Or does it make most sense to keep it near the function

bryceellis
Автор

Nice video, DocC is amazing! While you are in the developing process of an app, you might know every function. But after a few weeks break, it`s so hard and annoying to dive in the codebase again, if the project is big and you haven't write a documentation. 😵

marceljaeger
Автор

I've been using doc comments some, but learned some more cool things I didn't know about.

Also, you can use multi-line style commenting for doc comments, too — i.e. /** and close with */

JasonMitchellAZ
Автор

Just a quick question, can you collapse these comments in the code base or hide them in some other way? Yes, it's good to see them, but for me it's too confusing when I see so many lines of comments.

TE_-.-
Автор

Kudos for learning this shit. Couldn’t do it. Bored me to death

bored
Автор

Is there somewhere that documents the Documents! I knew about - Important: but not about the others or add code examples. There are other like - Authors: etc

nigelgee
join shbcf.ru