     
     fileprivate subscript (i: Int) -> String {
         return String(self[self.characters.index(self.startIndex, offsetBy: i)])
+    }
+    
+    func image() -> UIImage {
+        let size = CGSize(width: 22, height: 22)
+        UIGraphicsBeginImageContextWithOptions(size, false, 1);
+        UIColor.clear.set()
+        let rect = CGRect(origin: CGPoint.zero, size: size)
+        UIRectFill(CGRect(origin: CGPoint.zero, size: size))
+        (self as NSString).draw(in: rect, withAttributes: [NSFontAttributeName: UIFont.systemFont(ofSize: 20)])
+        let image = UIGraphicsGetImageFromCurrentImageContext()
+        UIGraphicsEndImageContext()
+        if let image = image {
+            return image
+        }
+        else {
+            return UIImage()
+        }
     }
 }
 

            strongSelf.sectionTitles.removeAll()
            strongSelf.splittedContacts.removeAll()
            
            for dict in self.contacts
            {
                let name = dict[LocalConstants.ContactNameKey]!
                
                if dictContact[name[0].uppercased()] != nil
                {
                    dictContact[name[0].uppercased()]?.append(dict)
                }
                else if !strongSelf.indexes.contains(name[0].uppercased())
                {
                    if dictContact[LocalConstants.ContactHashKey] != nil
                    {
                        dictContact[LocalConstants.ContactHashKey]?.append(dict)
                    }
                    else
                    {
                        dictContact[LocalConstants.ContactHashKey] = [dict]
                    }
                }
                else
                {
                    dictContact[name[0].uppercased()] = [dict]
                }
            }
            
            strongSelf.sectionTitles = Array(dictContact.keys).sorted(by: <)
            
            if strongSelf.sectionTitles.count > 0
            {
                if strongSelf.sectionTitles[0] == LocalConstants.ContactHashKey
                {
                    let indexFirst = strongSelf.sectionTitles[0]
                    strongSelf.sectionTitles.removeFirst()
                    strongSelf.sectionTitles.append(indexFirst)
                }
            }
            for key in strongSelf.sectionTitles {
                if let arrSectionContact = dictContact[key] {
                    strongSelf.splittedContacts.append(arrSectionContact)

                        do {
                            let containerResults = try contactStore.unifiedContacts(matching: fetchPredicate, keysToFetch: keysToFetch as! [CNKeyDescriptor])
                            contacts.append(contentsOf: containerResults)
                        }
                        catch {
                            message = LocalConstants.ErrorFetchingContacts
                        }
                    }
                    
                    if contacts.count != 0 {
                        self.didFetchContacts(contacts)
                    }
                    else {
                        message = LocalConstants.ErrorFetchingContacts
                    }
                    
