ios Blogs
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
Kiprosh is now part of LawLytics
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
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
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
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.
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,
What is Push Notification ? Push notification is a feature that allows an app to notify user of new messages or events, even when the user is not actively using your application. Like on Android devices, how a whatsapp message will make a sound and icon appear in the status bar. What is Apple Push Notification service(APNs) ? "Apple Push Notification service" is the service for implementing the push notification feature for IOS devices. How it works ? Each device establishes encrypted IP connection with the service and receives notifications over this persistent connection. If a notification for an application