How to Use OptionSet in Swift with code samples
Discover how to use Swift’s OptionSet to represent multiple Boolean options, and see a side‑by‑side comparison with an enum‑based approach — complete with code samples.
Articles about Swift and iOS development by Vlad Butko.
Discover how to use Swift’s OptionSet to represent multiple Boolean options, and see a side‑by‑side comparison with an enum‑based approach — complete with code samples.
Learn how to implement custom decoding logic for Swift enums. This article covers case-insensitive decoding, combining multiple incoming values into single enum
cases, and unit testing your custom logic.
Explore the importance of cell deselection in UITableView
and UICollectionView
when transitioning between views in iOS development. This article provides a step-by-step guide on how to mimic SwiftUI's native NavigationLink
deselection behavior in UIKit, along with Swift code examples, including a handy UIViewController
extension.
Discover how to preserve the user-preferred window size in your Mac Catalyst apps with this step-by-step guide. Learn how to use the new UIWindowScene.effectiveGeometry
and UIWindowScene.requestGeometryUpdate(_:errorHandler:)
APIs introduced in iOS 16.0 to provide a seamless and intuitive user experience on macOS.
Create lists using a modern compositional layout list configuration for a UICollectionView. In addition, we'll use a diffable datasource to populate our list content. Sample project included.
Show multiple windows with custom configurations to enrich user experience on a Mac and iPad. To do this, we'll create and configure a separate Window Scene Configuration. Code sample project included.
Let's have a look at how we can implement focus state management in SwiftUI before iOS15. With the help of UIKit, we'll be able to select a focused field, deactivate and restore the focus state on the screen.
Since iOS15, we can @FocusState property wrapper to manage the focus state in the app. Have a look at how to use it in practice.
Three different ways of dismissing a modal SwiftUI view embedded in UIKit: using presentationMode
and dismiss
environment values as well as providing a dismiss action from the presenting view controller.
SwiftUI environment values presentationMode
and dismiss
are here to make dismissing presented views a trivial task.
Adding shadows in UI is a common and easy task, but there are some caveats that you should keep in mind to use do it properly.
Compositional layout provides us with different ways of controlling cell sizes. It's simple and flexible. In the article, we'll see one reason why self-sizing may not work and how to use self-sizing behavior correctly.