Customize native alert view in iOS

Nearly every project/app needs an alert popup. It is an essential UI element to: Provide information/warning to the user before performing any actionHandle user interaction to perform any actionNotify the user on completion of an actionThe default alert popup is very simplistic. Nowadays, we see a unique style and attractive UI in popups rather than showing a classic native/default one. What do you show in a popup? Title, message, image, and action buttons. Isn't it? But if you want to make your custom alert popup, it requires a lot of effort as you need to manage UI

Environment setup to manage different app name, icon and endpoint using Xcode Configurations in iOS Swift Language

As a Developer, you have many challenges while you are working with many environments and endpoint in the same project. Without environment setup, you have to set the endpoint and certificate every time for a different environment. If we Configure Xcode for the different environment, It takes care of all endpoint, certificate and bundle ids. so the user can test all beta, dev and live app on the same device. So, let's start with creating Endpoint Endpoint Configuration The first thing that you have to do is prepare Xcode configurations for the environment you want to use. In this post,

Face ID Authentication in iOS11 Swift Language

Apple released most interesting feature Facial recognition with iPhone X. Face ID is a new revolution in recognition. It is a powerful and secure authentication system that’s more convenient, faster and easy than Touch ID. Face ID is biometric authentication. Biometrics technology is mainly used for identification and access control. Touch ID recognition is also biometric authentication. Face ID uses LocalAuthentication Framework for authentication and Touch ID uses the same framework for authentication. This framework provides facilities for requesting authentication from users. It provides the interface for evaluating authentication policies and access controls and managing credentials with LAContext. LAContext

Make Indicator always visible for UIScrollView in iOS Swift Language

Naturally, Indicator of ScrollView is visible when the content view of ScrollView is longer than ScrollView height and user drag on Screen. As we all know It is a default functionality, we can't make it always visible directly. Using flashScrollIndicators() method we can make it visible. Example override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(true) scrollView.flashScrollIndicators() } But indicator only appears for some time after viewDidAppear method call and disappear again. Indicator only to reappear when the user touches the screen. To show indicator continuously without touching screen you can add flashScrollIndicators() method in Timer. Timers work in continuously with

3D touch Quick Actions in iOS Swift Language

In iPhone, A user can now press Home screen icon to immediately access 3D touch Quick Actions functionality provided by your app. By Pressing hard on the home screen icon can now launch a quick action menu to take the user directly to parts of the app. Users with devices that support 3D Touch will use this feature. You can add this feature quickly. Home Screen Quick Actions Quick actions can be static or dynamic. You can define static actions at build time and dynamic actions at runtime. Static actions are visible to the user when they install or update

Detect data using NSDataDetector in iOS Swift language

NSDataDetector There are many application that extracting specific desired information from a string like date, url, link, address, number and many more. Using this specific desired information we can perform many useful action like create a event, open a url, save a contact number, navigate to particular address. Example The NSDataDetector class can match dates, addresses, links, phone numbers and transit information. NSDataDetector will be return one of the data detectors type, depending on the type of result being returned and they may have different properties. For example, Result of type link have have a url, result of type date

Create Contact Using iOS Swift language

The Contacts framework provides Swift and Objective-C API to access and create a new contact. This framework is optimized for thread-safe, read-only usage. The contact class (CNContact) has a mutable subclass CNMutableContact for use to modify contact properties like phone numbers, email addresses, an array of CNLabeledValue objects. CNLabeledValue contain label and value. Labels describe each value to the user, It allowing differentiation such as home and work for properties and you can create your own custom label using Contact Framework. Create contact using CNMutableContact import Contacts // Contact name prefix contact.namePrefix = "Mr." // Contact first name contact.givenName

Basic Animation using CABasicAnimation in iOS Swift language

CABasicAnimation An object that provides basic, single-keyframe animation capabilities for a layer property. Using init(keyPath:) method of CABasicAnimation you can animated particular the key path of the property. Properties of CABasicAnimation var fromValue: Any? Defines the value the receiver uses to start interpolation. var toValue: Any? Defines the value the receiver uses to end interpolation. var byValue: Any? Defines the value the receiver uses to perform relative interpolation. All properties are optional, and no more than two should be non-nil. The object type should match the type of the property being animated. We can also set duration and repeat

Presenting a UIPopoverPresentationController popup for iPhone

iOS 9 introduced a new way of creating Popovers on iPhone. Instead of using the UIPopoverController class we can now use the UIPopoverPresentationController. Presenting a Popover from a Bar Button Item We need a content View controller that's displayed inside the Popover and also need to set properties for contentSize, modalPresentationStyle and sourceView. Action for right BarButtonItem- @IBAction func addEntity(_ sender: UIBarButtonItem) { let vc: TableViewController = self.storyboard?.instantiateViewController(withIdentifier: "TableViewController") as! TableViewController // Preferred Size vc.preferredContentSize = CGSize(width: 200, height: 200) vc.modalPresentationStyle = .popover let popover: UIPopoverPresentationController = vc.popoverPresentationController! popover.delegate = self popover.sourceView = self.view // RightBarItem popover.

Add new instance methods to existing types using Extension in Swift

Extensions add new functionality to an existing type. Type can be class, structure, enumeration or protocol. This includes the ability to extend types for which you do not have access to the original source code. Extensions in Swift can add computed instance properties and computed type properties. Extension helps to use more usable method by declaring it once in extension which means no need to redeclare and repeat same method in every class. Extension Syntax Declare extensions with the extension keyword: extension SomeType { // new functionality to add to SomeType goes here } This example adds method to Swift's build-in UIViewController type,