Tag: Swift
-
In Swift, why protocol initializers must be defined as required in conforming types?
You may have asked yourself “why either the conforming types must define initializers of protocols as ‘required’ or they must be final”.
-
In Swift, why cannot we add designated initializers in extension?
We cannot define designated initializers in extensions. But why is that? In this post I am going to show you an example of the reason of that.
-
In Swift, why cannot we use generic protocols as normal protocols?
In Swift, generic protocols can only be used as a generic constraint. But why is that? Why we can’t use them as normal protocols?
-
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…
-
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…
-
iOS, How to check if the device is locked or unlocked 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…
-
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.
-
Objective-C for Swift Developers, Book Introduction
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…
-
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…