KBContactsSelection icon indicating copy to clipboard operation
KBContactsSelection copied to clipboard

Swift support?

Open enstulen opened this issue 8 years ago • 1 comments

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

enstulen avatar Mar 25 '16 23:03 enstulen

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)
    }
}

burczyk avatar Apr 10 '16 13:04 burczyk