Category: SwiftUI
-
Opaque Types in Swift: Hiding Details, Not Power
Have you ever wanted to return some kind of value from a function but didn’t want to expose exactly what type it is? Like telling the compiler, I’ll tell you it conforms to a protocol, but you don’t need to know the concrete type. Just trust me, it’ll work. Well, that’s what opaque types are…
-
SwiftUI 3D Charts: Add a Whole New Dimension to Your Data
Hey Swifters 👋 , Today we are going to dive into brand new 3D charts in SwiftUI. Introduced in iOS 26, Chart3D brings depth (literally) to your visualizations. You can now plot data using the X, Y, and Z axes and rotate, tilt, and explore datasets in a much more immersive way. Let’s dig in.…
-
@preconcurrency in Swift
Hey Swifters 👋 I this guide we will explore @preconcurrency in Swift. You have probably been loving the new Swift Concurrency features async/await, Task, actor, and the rest of the crew. But sometimes you have to interact with older code, the kind that wasn’t written with concurrency in mind. And that’s when you might stumble…
-
Swift Concurrency: Actors, isolated & nonisolated
Hey Swifters 👋 In this guide, we will explore actor in Swift and a few other relevant topics as well. If you have dipped your toes into Swift Concurrency, you might have probably come across actor, isolated, and maybe even nonisolated. They might sound intimidating at first, but they are actually your friends, especially when…
-
Clean, Reusable Swift Code Using DRY Principle
Hey Switfers! 👋Today we will explore the DRY principle to make our Swift code clean and reusable. So have you ever written a function, copy-pasted it somewhere else, tweaked a line or two, and thought, this looks kinda familiar? If so, you have probably broken a rule we all learn (and forget) early on The…
-
Stepper in SwiftUI
Today, we’re going to dive deep into the Stepper control – a versatile and user-friendly way to increment or decrement values in your SwiftUI apps. We’ll explore various ways to implement and customize Steppers, from basic usage to more advanced techniques. What is a Stepper? A Stepper in SwiftUI is a control that lets users…
-
Fall Detection API in Swift for WatchOS
I was recently implementing the Fall Detection API in Swift/SwiftUI for watchOS, and I had a lot of trouble getting it working. The documentation was very sparse, and I ended up wasting a lot of hours trying to figure out how to use the API. I was finally able to get it working after about 95% of the way…