https://www.youtube.com/watch?v=eKtWY0962Hg 🎯 Difficulty: Intermediate to Advanced In this speed coding session, we write unit tests for a Swift ViewModel built with the MVVM architecture and powered by Combine and @MainActor concurrency. You’ll see how to: ✅ Write precise and meaningful unit tests using XCTest 🔍 Test async @MainActor functions with Combine’s @Published properties 🧪 Mock … Continue reading Speed coding – Unit Testing the MVVM in Swift
Dependency Inversion Principle (DIP) in iOS Swift
The Dependency Inversion Principle (DIP) is a fundamental concept in software development that helps create flexible and maintainable code. In this article, I'll explore its history, the problem of tight coupling, and different approaches to applying DIP in Swift. History of the Dependency Inversion Principle The Dependency Inversion Principle (DIP) was introduced by Robert C. Martin, also known … Continue reading Dependency Inversion Principle (DIP) in iOS Swift
Simplifying Logic with Swift: From if-else to switch Pattern Matching
When working with conditional logic in Swift, you often encounter scenarios that require checking multiple conditions. Traditionally, developers rely on if-else statements for such tasks. However, Swift’s powerful switch statement with pattern matching offers a cleaner and more elegant way to handle these situations. In this article, we’ll demonstrate how to transition from a verbose if-else structure to a concise switch statement using pattern matching, … Continue reading Simplifying Logic with Swift: From if-else to switch Pattern Matching
#6 Swift – TDD + Merge Two Lists (LeetCode)
Hi everyone, I am back, and this video is about how we can use Test Driven Development to solve Merge Two Lists algorithm Problem! We can use TDD to solve very small unit of logic, then we can keep refactor our code so that it can works in integration. #tdd #testdrivendevelopment #swiftprogramming #dsa #datastructuresandalgorithms #arifinfrds … Continue reading #6 Swift – TDD + Merge Two Lists (LeetCode)
#4 TDD + Binary Search
Hi, I am happy to share on how to use Test Driven Development on a Data Structure and Algorithm problem, in this case, Binary Search problem. Binary Search is one search of DSA problem and it is a good idea to solve that not only in raw, but also using Test Driven Development, to guarantee … Continue reading #4 TDD + Binary Search
#3 TDD + Palindrome Checker
Hi, I am happy to share on how to use Test Driven Development on a Data Structure and Algorithm problem, in this case, Palindrome Checker problem. Palindrome Checker in String is one of DSA problem and it is a good idea to solve that not only in raw, but also using Test Driven Development, to … Continue reading #3 TDD + Palindrome Checker
#1 Test Driven Development Reverse a String
Hi, I am happy to share on how to use Test Driven Development on a Data Structure and Algorithm problem, in this case, to Reverse a String problem. Reverse a String is one of DSA problem and it is a good idea to solve that not only in raw, but also using Test Driven Development, … Continue reading #1 Test Driven Development Reverse a String
Test Double : Stub
In the last article, we've already talk about Test Double in general. In this article, we will talk about on of test double, called stub. Testing a component can be helped with another collaborator component with predefined behavior. This is called stubbing. 💡 Stubs provide canned answers to calls made during the test, usually not responding at … Continue reading Test Double : Stub
Get Rid of `nil` Values using Dictionary.compactMapValues { $0 }
What is compactMapValues { $0 } ? compactMapValues {} can be really helps when we are dealing with optional values inside a dictionary. Readability is also important, especially amongs the developers. compactMapValues is one of the great language feature of Swift. "Returns a new dictionary containing only the key-value pairs that have non-nil values as the … Continue reading Get Rid of `nil` Values using Dictionary.compactMapValues { $0 }