An absolute beginner’s guide, a step by step Swift tutorial, we will learn how to use Date Picker, UIAlertController and Date objects
In this Step-by-Step tutorial we will create a simple age calculator application.
The user select his birth date from a date picker then he press a button,we then calculate his current age in years, months and days
Finally we display it in a UILabel.
What we will learn
How to calculate difference between two Date objects
How to use Calendar to get Date Components
How to use UIDatePicker
How to add Auto layout constraints to simple view
How to create and display a UIAlertController Continue reading “Absolute beginner iOS tutorial: Age Calculator application in Swift”
Using NSCoding, NSKeyedArchiver and NSKeyedUnarchiver to save array of custom objects to NSUserDefaults
NSCoding protocol enables an object to be encoded or decoded for archiving and saving to disk.
It declares two methods that your object must implement in order to be encoded and decoded. Continue reading “How to save Array of custom objects to NSUserDefaults”
What is it? when and how to use it
What is Singleton
Singleton is a design pattern that guarantees that only one instance of a class can be instantiated. Continue reading “Singleton in Swift”
A list of all fonts in iOS and learn how to get them in Swift
This is a list of all font names in iOS and how to get them Continue reading “All font names provided by iOS”
As an iOS developer you should know the different states of iOS app and understand the difference between them
At any given moment your iOS app will be in one of those states listed below
You app will be in this state if it was not launched yet or was terminated by the system.
This is a transition state, your app goes in Inactive state for a short time when launching it. Continue reading “Execution States of iOS Application”
Use this function to add a blur effect to UIImage in Swift
Blur effect using CoreImage
First import CoreImage framework Continue reading “Add blur effect to image in Swift”
The favorite interviewer’s question for iOS developers
What is the difference between Atomic and Nonatomic properties in iOS
This has been the favorite question in iOS developer job interviews for many years.
And it is also the first question a beginner iOS developer ask once he sees the declaration of a property in Xcode like this:
@property (nonatomic , strong) NSString *firstName;
The short answer is: Continue reading “Atomic and Nonatomic properties in Objective C”
You can add True Type Font (.ttf) or Open Type Font (.otf) to your app and use it the same way you use font provided by iOS.
Add your font file to your Xcode project
From menu bar select File->Add Files to “project_name” or just drag font files to your project Continue reading “How to add custom font to iOS app in Xcode”
How to detect if app is running for the first time
You can detect if the application is launched for the first time using NSUserDefaults.
Just by looking for a key called “launchedBefore” for example and if its not found then the application is running for the first time.
if not found then create it.
Add the following code to didFinishLaunchingWithOptions() in AppDelegate.swift file Continue reading “How to detect if application run for the first time in iOS using Swift 3”