iOS 11 New Navigation Bar and Search Controller

As we all know the apple is bringing all the new changes in iOS every year, they are improving the the UIKit for the better User Interface for iOS. Today we will see 2 new changes of UIKit in iOS 11. Navigation Bar Controller A navigation bar appears at the top of an app screen, below the status bar, and enables navigation through a series of hierarchical screens. When a new screen is displayed the back button appear with the label of previous screen title on the left side of the screen. We can also add button on the right

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

Use of DateFormatter in iOS using Swift

The DateFormatter help in the conversion between dates and textual representations. For example :- If you are working on the project and you are dealing with date or time to show in your app screen, the date or time format you receive is different from the format you want to display. Let say you got the date in "2017-11-15" and you need to display on screen as "15 November, 2017" so DateFormatter help us for conversion in the format as we want to display. Now let's see some more example for date and time conversion. Let

Use of Apple URL Schemes using Swift Language

Apple URL Schemes helps you to access system apps in iOS. Native iOS app uses this schemes to integrate with system apps and provide a more seamless experience to the user. For example :- If your app display telephone number you can use appropriate URL to launch phone app whenever user click on the telephone number. There are many functions of Apple URL Schemes used for such as :- 1. Phone Link :- Phone link helps you to make dialing experience easy for specific phone numbers. It will prompt an alert to the user to make a call or cancel

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

Custom UISlider using Swift Language

UISlider is a control used to select a single value from a continuous range of values. Default UISlider just provides track and thumb with default color having minimum value to maximum value. You can drag the thumb from the start point to the endpoint continuously in the range set. Default UISlider If you are using this control in your project, you need to customize the control to make your screen attractive(as per the design). Now let's customize the UISlider: You can customize color, thumb image, and track color easily. Basic customization can be done in two ways:- From

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,