Skip to content

Blog

Amir’s blog

Relative Date and Time with Swift

Relative Date And Time With Swift

You probably have seen the date and time of the messages in the Messages app and other messagings that are relative to the current date and time. This post will explain how to calculate the relative date and time with Swift.

Diffable Data Source with Clean Architecture

In WWDC2019, Apple introduced Diffable Data Source as a new approach for providing data for table view and collection views. Apple’s video was explained using an interesting sample project. This article shows how to use diffable data source with clean architecture in mind. To do so, I apply clean architecture to the WiFi settings part of Apple´s sample project of WWDC19.

Clean Architecture with NSFetchedResultsController

Probably the NSFetchedResutlsController makes the tightest coupling between UI and another layers of an iOS application. NSFetchedResutlsController Class has been created by Apple to provide a seamless data flow from Core Data layer to UIKit and vice a versa. The MVC is Apple’s native architecture and NSFetchedResultsController lays in the Model layer of this architecture perfectly but it cannot provide features like unit testing, low coupling, and independency. You might say that the lack of these possibilities is due to the MVC’s nature. I would answer yes, but these features are very important for having a well-structured application that is readable, testable, maintainable, and extendable. So if you value these traits, you do not have any problems with having some more small files in your project and you love Clean Architecture, keep on reading this article.

iOS, How to check if the device is locked or unlocked programmatically

Check iPhone Lock State Programmatically

Sometimes it is really necessary to know the device lock state especially when we are working with background services like Bluetooth or networking. Actually, iOS API does not let developers check if the device is locked or unlocked programmatically. But there is a workaround that lets us find it out with some seconds of delay after locking.

UITableView Selected Cell Background Color

UITableView Selected Cell Background Color

It is easy to change the background color of the selected cell in a table view. Each UITableViewCell has a selectedBackgroundView which is shown when the cell is selected. This view should be set programmatically and it’s better to do that in a UITableViewCell custom class.

Becoming iOS Developer Roadmap – 2021

iOS Roadmap Feature Image

This diagram illustrates the roadmap for becoming an iOS developer. I updated it to reflect recent changes in 2021. I have tried to collect the most important technical skills that a progressing iOS developer can learn, in a logical order, to succeed more and more.

Objective-C for Swift Developers, Book Introduction

Objective-C for Swift Developers

Without any doubt, Swift is the main programming language for developing new applications for Apple developers, but there are many apps on the App store that have been developed using Objective-C. Many of these apps are serving millions of users worldwide. So to build your career, you probably need to be able to read or even write Objective-C codes.

Swift Value and Reference Types, How to Use

Swift Value and Reference Types, How to Use

Based on the memory handling methods, types in Swift are divided into two different categories: value types and reference types. There are some basic differences between value and reference types which causes them to behave differently in the same conditions. So developers should know their specifications to write logical codes both during working with Apple’s predefined types and during defining their own custom types.