burczyk / KBContactsSelection

Easily search and select contacts in your iOS Address Book and redirect to Mail or Messages with results.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swift support?

enstulen opened this issue · comments

I'm having problems using this with Swift getting the error "Could not build Objective-C module"

I've just checked that and you're absolutely right. I haven't found a real solution for that but a small walkaround may be like this:

  1. Make sure you enabled use_frameworks! in Podfile.
  2. Open Pods → KBContactsSelection → APContact+FullName.h file and change #import "APContact.h" to @import APAddressBook; (when Xcode asks select Unlock file),
  3. Open Pods → KBContactsSelection → KBContactsTableViewDataSource.h file and change #import "APAddressBook.h" to @import APAddressBook;

After these changes I was able to use library in Swift with no further problems, e.g.:

import UIKit
import KBContactsSelection

class ViewController: UIViewController {
    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)

        let vc = KBContactsSelectionViewController { (configuration) in }
        presentViewController(vc, animated: true, completion: nil)
    }
}