Tabs bars are one the most recognizable UI elements for an iOS apps. We can find this element in build in apps like Phone, Photos, Music, AppStore, and many more.
Lucky for us, this element is quite easy to use, and in this tutorial, we’ll learn how to create a tab bar programmatically using UIKit. Let’s start!
Simple example Let’s start by configuring our project to allow us to instantiate our views programmatically.
VSCode + Dev Containers are a great way to create custom environments without modifying our actual system.
They provide a consistent development environment, ensure dependencies are managed correctly, and make it easy to share setups with your team.
Here are some configurations you can use to create them.
Vapor { "name": "Swift", "image": "swift:latest", "features": { "ghcr.io/devcontainers/features/common-utils:2": { "installZsh": "false", "username": "vscode", "userUid": "1000", "userGid": "1000", "upgradePackages": "false" }, "ghcr.io/devcontainers/features/git:1": { "version": "os-provided", "ppa": "false" } }, "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], "customizations": { "vscode": { "settings": { "lldb.
Lately, I’ve been writing a lot about UIKit and I noticed I haven’t covered the delegate pattern.
This pattern is not exclusive to UIKit but it’s quite used in this framework.
In this post, we’ll dive into the Delegation Pattern, a fundamental design pattern in iOS development that helps in creating a well-structured codebase.
What is the Delegation Pattern? The Delegation Pattern is a design pattern where one object (the delegator) hands off (or delegates) some of its responsibilities to another object (the delegate).
One common issue with programmatic UIKit development is dealing with the creation and configuration of UI objects. Configuring UI elements in our code can be cumbersome and hard to synchronize their behavior and style across several screens.
By using the Builder Pattern, we can centralize the creation and configuration of these objects. This simplifies our codebase and decouples the creation of UI objects from our views.
What is the Builder Pattern?
One of the standout features of SwiftUI is its reactive paradigm, which seamlessly updates views as data changes. This powerful approach isn’t confined to SwiftUI alone; it can also be harnessed in UIKit through the use of the Combine framework, and starting with iOS 17, through the new Observation framework.
In this post, we’re going to explore using MVVM with UIKit, leveraging Combine to achieve reactive behaviors similar to SwiftUI. I hope you find this information useful and that it helps you improve the way you create and think about your applications.