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,