When you start building apps in Swift or SwiftUI, you’ll often hear the term “Copy-on-Write” — or CoW for short. It sounds fancy, but the idea is actually very simple and smart. Let’s break it down. Swift uses value types like struct , Array , Dictionary , and String . Normally, when you copy a value type, you’d expect it to create a new copy in memory. But copying big data every time can be slow and wasteful. So Swift uses a trick called Copy-on-Write — it pretends to copy the data, but it doesn’t actually do it until you change something. var numbers = [1, 2, 3] var moreNumbers = numbers // No real copy yet! moreNumbers.append(4) // Now Swift makes a real copy here. At first, both variables share the same data. Only when you modify moreNumbers, Swift creates a separate copy so that the original numbers stays safe. This is how Swift gives you safe, independent data but still keeps things fast and memory-friendly. How It Connects to SwiftUI Now he...
Recently I published a countdown app . At one point of development - I have to show a timer on a UILabel which ticks on each seconds. As usual I started setting text to a label object - self .timerLabel.text = someString Easy piece of cake right !? But wait ... it won't take much user attention when timer ticks on every seconds. So I decided to make use of a simple animation while label gets text update. I found there are dozens of ways to animate a label. In this short article, I listed 3 best way you can animate text on a label. ( Spoiler Alert 👀- I decided to go with 3rd option) 1. Fade In - Fade out animation : CATransition class has got transition type `fade`. With timing function of CATransition - I was able to see the below result. let animation: CATransition = CATransition () animation.timingFunction = CAMediaTimingFunction (name: CAMediaTimingFunctionName .easeInEaseOut) animation.type = CATransitionType .fade animation.subtype = C...