Equatable conformance allows you to compare one object with another. Based on whether the objects match, you can perform a specific operation. You can rely on default comparison implementations or custom logic to compare two objects. Many standard types are already comparable, but you must implement protocol conformance for your custom types. Secondly, you could …
View Composition using ViewModifiers in SwiftUI
View Composition allows you to create reusable components to create enriched views. You can extract logic into reusable components using the ViewModifier protocol in SwiftUI and set up your code for reusability. I’ve been developing a set of view modifiers in RocketSim to enable TextField customizations. Combining all modifiers results in the most advanced TextField, …
Introducing Roadmap: Offer Public Feature Voting
Roadmap is a new open-source framework written completely in Swift and SwiftUI, allowing you to integrate feature voting functionality for your apps. While developing apps, spending your time on the most impactful features is essential. While the definition of impactful divers it’s certainly driven by what your users want to see in your app. With …
Detached Tasks in Swift explained with code examples
Detached tasks allow you to create a new top-level task and disconnect from the current structured concurrency context. You could argue that using them results in unstructured concurrency since you’re disconnecting potentially relevant tasks. While it sounds terrible to disconnect from structured concurrency, there are still examples of use cases in which you can benefit …
Xcode Simulator Directories Exploration
Xcode Simulator directories allow you to find related files for your app. Unlike on a real device, you can access all folders that represent the app your building. Exploring those directories allows you to debug and optimize accordingly. Whether you’re debugging storage issues, optimizing app binary size, or looking to adjust the user defaults from …
Task Groups in Swift explained with code examples
Task Groups in Swift allow you to combine multiple parallel tasks and wait for the result to return when all tasks are finished. They are commonly used for tasks like combining multiple API request responses into a single response object. Read my article about tasks first if you’re new to them, and make sure you’ve …
Engineering goals: How to become a more successful developer
Engineering goals create focus and help you achieve the milestones of becoming a successful developer. You’ll know better what you’ve accomplished in the past months, and make sure that you work on projects with the highest impact. Over the past years, goals helped me successfully release new versions of RocketSim and Stock Analyzer. While I …
SwiftLee 2022: A Year in Review
Another year passed by, and we’re close to getting into 2023. It’s been a year with a single Swift 5.7 release, Xcode 14, new SwiftLee products, and many articles. I always enjoy looking back on the year and realizing what I’ve achieved, hopefully inspiring others for the year to come. More than ever, I’ve been …
OptionSet in Swift explained with code examples
OptionSet in Swift allows you to define a set of options for configurations. It’s the Swift variant of the well-known NS_OPTIONS in Objective-C and it’s used throughout the standard libraries. A set of options is often confused by a set of enum cases, but they’re not the same. While you could create a similar solution …
How to use FormatStyle to restrict TextField input in SwiftUI
A custom FormatStyle can help you control the allowed characters of a SwiftUI TextField. You might want to allow numbers only or a specific set of characters. While you could use a formatter in many cases, it’s good to know there’s a flexible solution using a custom FormatStyle implementation. In my case, I was looking …