Anytime the data changes, the view needs to update.
View depends on the data. In our case: a view establishes a direct dependency on specific data / a specific data source.
When building a new view, start by first asking yourself:
Where your data comes from is the
source of truth of your view. This decision has a profound influence on where you…
It’s been a while since Apple introduced the Combine framework with iOS 13 in 2019, but I only recently decided to learn it because the majority of active iOS devices are now running iOS 13. There are plenty of resources on the internet (free or paid, reads or code-along) that talk about Combine at all levels. However, I spent many nights feeling confused after going through countless articles before feeling confident enough to write my first
import Combine in the production code of my current project.
If you feel the same after spending time learning about Combine, this article is…
I don’t need to have expert knowledge in user experience to realize that users don’t like to be left in ambiguity. Users require an immediate and clear visual indicator of the current state of the product they are using. In real life, when there is nothing on the table, we leave it tiny like that. But in an app, we want to show some custom content when the table view is empty to tell the user about that.
If you work in a team with designers, it is their responsibility to give you, the developer, instructions on what to display…
When I first learned SwiftUI, I was amazed by how much is done automatically for us by SwiftUI. For example, I no longer have to write custom
UIView.animateWithDurations remember to make constraint changes outside and call
view.layoutIfNeeded inside animation block.
We get a lot of conveniences when using SwiftUI. For it to work for us, not against us, there are certain rules we should follow when structuring our View’s code.
Three key players affect how SwiftUI manages and updates the views:
How SwiftUI recognizes views as same, or unique across multiple updates of your app. …
Key-Value Observing pattern, commonly known as the KVO pattern had existed since the inception of Cocoa. It is used to notify objects about changes to the properties of other objects.
When it comes to communicating changes between logically separated parts of your app, we have several options. One of the most widely used is the
Delegation pattern, as demonstrated in the following example:
Delegation is most useful…
Xcode’s graphical interface provides a convenient and powerful way to manage image assets and you should already be familiar with how it is used if you’ve ever included images in your app.
Turns out, it not only lets you manage image assets but also allows you to localize your image assets by providing different images for different locales. All you need to do is define for which locales the assets should be used, and provide the correct localized image for each locale.
This is done for each image asset so that you can choose to localize only those worth localizing.
Let’s start with a quiz. Consider the view structure:
Xcode had evolved a lot, making it easier than ever to make your app support multiple languages. This post will focus on exporting and importing localization files using Xcode and assumes you have enough knowledge about the process of localization or internalization.
If you need more information on implementing localizations, here are my article recommendations:
The content in this article requires you to be familiar with the process of internationalization in Xcode.
Follow any of the articles and you…
I started implementing an AVPlayer with standard capabilities. The user can play, pause, and drag the slider (implemented with an
UISlider) to seek a point in the video.
While dragging, the player will stop updating the slider with the current progress derived from
player.currentTime() / player.duration. Usually, this is done by setting up an observer with
slider.value will be used to calculate and reflect the progress pointed by the user’s dragging. Once the user releases the slider, we use
player.seek() to continue playing the video from the time converted from
On the slider…
We should all be familiar with the action sheet that iOS uses in the system settings and Apple native apps: