Kodebits: The First Month

Kodebits launched in April with 14 bite-sized coding insights across iOS, Android and Flutter. Here’s the full month-one archive, grouped by platform and sorted from warm-up to deep end. By Sam Davies.

Save for later
Share

Kodebits launched at the start of April as our home for bite-sized coding insights. They are short challenges and snippets you can work through in a coffee break. Each one drops first on social media, then lives on the Kodebits archive for the long term.

Across the first month we published 14 Kodebits spanning iOS/Swift, Android/Kotlin and Flutter/Dart. This roundup gathers all of them in one place, grouped by platform and ordered from easiest to hardest, with a short note on what each one is good for. If you missed any, this is the catch-up.

When you visit each of the Kodebit pages, you’ll see the problem, along with a solution and explanation. We’ve also provided links to content across the site that will allow you to delve deeper into the topic covered.

iOS & Swift

Seven Kodebits in April make Swift our most-covered platform of the month, and the topics span most of what makes Swift distinctive: optionals, protocol-oriented programming, value semantics, and the type system’s quieter corners. There’s something here whether you’re still getting comfortable with guard or you’re ready to wrestle with associated types.

Beginner

  • Day 1: Optional Chaining A refresher on Swift’s optional chaining and nil-coalescing operators. These two tools handle the bulk of nil-related code you write day-to-day, and getting them into muscle memory makes the rest of Swift feel a lot less ceremonial.
  • Day 6: Guard Optionals Practice unwrapping optionals with guard let. Where if let nests, guard let reads top-to-bottom and keeps your happy path flat. A small change that makes function bodies considerably easier to follow.

Intermediate

  • Day 2: Property Wrappers A look at how property wrappers encapsulate storage logic behind a simple @-prefixed annotation. If you’ve used @State or @Published and wondered what’s actually going on under the hood, this peels back the layer.
  • Day 8: Result Mapping Transform a Result‘s success value with map while leaving any failure untouched. A neat way to chain transformations without writing a switch for every step, and useful preparation if you’re moving toward more functional patterns.
  • Day 10: Protocol Extension Use protocol extensions to provide default behavior, so conforming types only need to implement what’s actually different. A core technique behind protocol-oriented programming and a big part of why the Swift standard library stays so compact.

Advanced

  • Day 5: Closure Capturing Closures capture values by reference by default in Swift, which can lead to surprising bugs when you assumed you were getting a snapshot. This bit shows the trap and the fix, and it’s worth taking a look even if you think you’ve got it sussed.
  • Day 13: Associated Types Associated types let a protocol describe “a value of some type to be decided later”, the foundation for generic, reusable abstractions like Collection. Genuinely tricky on first contact, and worth coming back to once or twice.

Android & Kotlin

Four Kodebits in April, with a strong lean toward Kotlin’s null-safety story (which is, fairly, what most developers arriving from Java want to understand first) plus looks at data classes and a functional approach to error handling.

Beginner

  • Day 3: Null Safety An introduction to how Kotlin distinguishes nullable and non-nullable types at the type level, moving most of the NullPointerException problem from runtime to compile time. Foundational reading for anyone coming over from Java.
  • Day 7: Null-safe Length Combines the safe-call operator (?.) with the Elvis operator (?:) in a single small function. Once this pattern clicks, you’ll spot opportunities to flatten nullable-handling code all over your codebase.

Intermediate

  • Day 11: Data Class Copy Use copy() to derive a modified version of a data class without mutating the original. Cornerstone technique for working with immutable state, particularly relevant if you’re managing state in Compose or any unidirectional data flow.

Advanced

  • Day 14: runCatching Fallback Wrap a call that might throw in runCatching, then use getOrElse to supply a fallback when it does. A neat alternative to try/catch when you want the failure path to be a value rather than a control-flow detour, and a stepping stone toward more functional error handling in Kotlin.

Flutter & Dart

Three Kodebits showing off the Dart syntax tricks that make Flutter widget trees readable. Each one is the kind of small thing you don’t strictly need but immediately miss when you switch to a language without it.

Beginner

  • Day 9: Collection If Conditionally include items in a list using if directly inside the collection literal. A cleaner alternative to building a list and filtering it afterwards, and especially handy for assembling widget children based on state.

Intermediate

  • Day 4: Cascade Notation Use the .. operator to call multiple methods on the same object in a single expression. A small piece of syntactic sugar that makes builder-style code much more pleasant to read and write.
  • Day 12: Null-aware Operators Combines safe access (?.) with fallback defaults (??). The same null-handling thinking we saw in Swift and Kotlin, applied in Dart. Useful as a comparison if you work across more than one of these languages.

What’s next

Kodebits continue through May with the same cadence and the same mix of platforms. New bits land on social media first, so our social channels are the fastest way to catch them as they go out. Everything else lives on the Kodebits archive.