HEhuda elhadyinhudaios.hashnode.dev00Mutable Dictionary Keys in Swift: A Bug Waiting to Happen5d ago · 3 min read · Let's imagine we have cartItems dictionary that has product as key and number of items as value struct Product: Hashable { var id: Int var name: String } var cartItems = [Product: Int]() varJoin discussion
HEhuda elhadyinhudaios.hashnode.dev00Swift Performance: Stop Creating Intermediate Arrays with .lazyMar 23 · 2 min read · so what happens when we write this code struct User { let name: String let isActive: Bool let avatarURL: URL } func search(query: String, in users: [User]) -> [UserRow] { Array( Join discussion
HEhuda elhadyinhudaios.hashnode.dev00Swift: Copy on Write Automatic vs ManualMar 7 · 3 min read · For a long time I thought CoW happens automatically in Swift and I found that this is not entirely correctAutomatically CoW:so for array, dictionary, set, string and data it happens automatically // aJoin discussion
HEhuda elhadyinhudaios.hashnode.dev00Swift: High-Level Code, Zero Performance Cost Mar 6 · 1 min read · Today I learned something new about Swift — we can write high-level elegant code with zero cost.I wanted to write a simple code that goes through array elements and multiplies each element by 2, and IJoin discussion