TechDiary Tech Blog

Swift
Swift Struct mutating Keyword Explained: When Value Types Need to Modify Themselves

Seren  |  18 May, 2026
Leave a comment

Swift mutating keyword exists because value types are immutable by default — a design choice that prevents accidental side effects but sometimes gets in the way when you need a struct method to modify its own properties. My first reaction was: it’s my own property, why can’t I change it? This problem sits right at […]

Swift
Swift Concurrency: Async/Await in Real Projects

Seren  |  15 May, 2026
Leave a comment

Before 2021, writing asynchronous Swift code meant callback hell — nested closures, manual error propagation, and a lot of mental gymnastics. Swift 5.5 introduced async/await, and for the first time, async code could finally be written linearly, just like synchronous code. This article skips the theory. We’re starting with how to use it in real […]

Swift
Result Enum: Handling API Success and Failure Elegantly

Seren  |  13 May, 2026
Leave a comment

A network request either succeeds or fails. But somehow, this simple binary outcome has led to some of the ugliest code I’ve seen — double closures, optional nils pretending to be errors, and callback pyramids full of if-else. Swift’s standard library Result enum was built exactly for this. This article doesn’t waste time on how […]

Swift
Swift Generics Advanced + Protocol Associated Types: From “Can Use” to “Can Design”

Seren  |  11 May, 2026
Leave a comment

Everyone knows the basic generics syntax. But when it comes to associatedtype in protocols, generic constraints, and where clauses, many developers get stuck. This article skips the func swap<T>(_ a: inout T, _ b: inout T) beginner examples — I’m starting with when you actually need these advanced features in real projects. It took me […]

Swift
Swift Higher-Order Functions: map, filter, reduce, flatMap in Real Projects

Seren  |  08 May, 2026
Leave a comment

After three years of writing Swift, I’ve learned one thing: the less I use for loops, the fewer bugs I ship. It’s not magic — higher-order functions shift your thinking from “how to do it” to “what to do,” and that clarity naturally eliminates a whole class of mistakes. This isn’t a rehash of the […]

Swift
Swift Closures Explained: @escaping, Non-Escaping, and Trailing Closures with Code

Seren  |  06 May, 2026
Leave a comment

Closures are one of Swift’s most essential features. Most articles tell you how to write them. This one tells you why Swift distinguishes between escaping and non-escaping — and why that distinction matters for performance and memory safety. I learned this the hard way when a retain cycle in an escaping closure caused a memory […]