I have this variable in a swift file:
var adbk: ABAddressBook!
Which has always been fine, until Xcode 7.1. Now it complains "Property with retain or strong attribute must be of object type." The error is in the -Swift.h
file. Any idea what got changed that would cause this and how to fix it?
This error occurs if Swift class declares some of the AdressBook properties and this class is part of the mixed Swift / ObjC project. Xcode then generate Swift bridging header, where this property becomes (nonatomic, strong), which is applicable to objects only, not structures.
I have encountered similar issue when I needed to pass ABRecordRef from Objective-C class to Swift class: Xcode didn't like my ABRecordRef property in Swift. So I've ended up making that property private, so that it is not exported to the bridging header, and adding new method in Swift class to receive ABRecordRef:
class: PersonDetails {
private var selectedPerson: ABRecorfRef?
func setPerson(person: ABRecordRef) {
selectedPerson = person
}
}
And then you can call
[personDetails setPerson: person];
from Objective-C class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With