     
     func dismissKeyboard(){
         view.endEditing(true)
+    }
+    
+    func addressbookAccess() {
+        switch ABAddressBookGetAuthorizationStatus(){
+        case .Authorized:
+            print("Already authorized")
+            createAddressBook()
+            /* Access the address book */
+        case .Denied:
+            print("Denied access to address book")
+            
+        case .NotDetermined:
+            createAddressBook()
+            if let theBook: ABAddressBookRef = addressBook{
+                ABAddressBookRequestAccessWithCompletion(theBook,
+                                                         {(granted: Bool, error: CFError!) in
+                                                            
+                                                            if granted{
+                                                                if let people = ABAddressBookCopyArrayOfAllPeople(self.addressBook)?.takeRetainedValue() as? NSArray {
+                                                                    // now do something with the array of people
+                                                                }
+                                                                print("Access granted")
+                                                            } else {
+                                                                print("Access not granted")
+                                                            }
+                                                            
+                })
+            }
+            
+        case .Restricted:
+            print("Access restricted")
+            
+        default:
+            print("Other Problem")
+        }
     }
 }
 

//

import UIKit

class AddFriendsViewController: UIViewController, UIScrollViewDelegate {
    

        manualTabBottomBorder.hidden = true
        addressBookTabView.alpha = 1.0
        addressBookTabBottomBorder.hidden = false
        
        addressbookAccess()
    }
}

