Skip to main content

Swift Knowledge Base - free Swift example code

About 3 minSwiftArticle(s)bloghackingwithswift.comcrashcourseswiftxcodeappstore

Swift Knowledge Base - free Swift example code 관련

Swift Knowledge Base - free Swift example code

Learn Swift coding for iOS with these free tutorials – learn Swift, iOS, and Xcode

Free example code you can take and re-use in your own projects.

This is the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions, all written for Swift. You can search all questions by typing below, or browse by category.


Browse by category…


Looking for SwiftUI?

SwiftUI is such a big topic that it has its own dedicated guidebook: SwiftUI by Example. This follows the same hands-on approach as the Swift Knowledge Base, but goes into much more depth to help you get started faster.


Frequently asked questions

Can I use this code in my project?

Yes! I have a very permissive license that allows almost everyone to use my code commercially and non-commercially – please see my full code license for detailsopen in new window.

Why is this better than just using Google?

Swift is a language that has changed a lot since its launch, and continues to change with every new Xcode release. This frequently makes it hard to find answers to common questions, because what worked a year ago is today probably incompatible! So, I made this as a one-stop-shop for 600 of the most common questions I get asked about Swift – you don't need trial and error: everything here has been tested thoroughly.

Why are some answers so brief?

I tried to make every answer brief, because when you're looking for answers you don't want to read waffle. If you're looking for answers and only answers, this is the right place. If you're looking for explanation and elaboration, you should read the main Hacking with Swift tutorial series.

Why are some answers so easy?

I get a lot of questions from readers every day, some on Disqus, some on Twitter, and some by email. I've tried to make the answers you see here representative of the questions I get, and it's true: there is a huge range of skills out there. So, some questions are easy, some are hard, and some are in between – and that's okay.

Why is there nothing about SomeAwesomeClass?

Like I said, these questions were put together by summarising nine months of messages from readers, so if I missed something off it's probably because I wasn't asked very often or at all. If it's something you feel very strongly about, send me a tweet @twostrawsopen in new window.


이찬희 (MarkiiimarK)
Never Stop Learning.