[swift-users] "Unavailable instance method... used to satisfy a requirement of protocol"
James Dempsey
dempsey at mac.com
Fri Sep 15 11:40:20 CDT 2017
I am updating from Xcode 8 to Xcode 9, still using Swift 3.
In my project I am getting warnings of the pattern:
Unavailable instance method ‘compareQueryResult(_:toQueryResult:)’ was used to satisfy a requirement of protocol ‘ResultComparable’.
My project uses an Obj-C++ framework to wrap C++ and expose it in Obj-C.
The instance method in question is declared and implemented in a number of Obj-C classes in this framework.
@interface DocumentQuery: Query {
- (ComparisonResult)compareQueryResult:(DocumentResult *)result1 toQueryResult:(DocumentResult *)result2;
}
@end
@interface GroupQuery: Query {
- (ComparisonResult)compareQueryResult:(GroupResult *)result1 toQueryResult:(GroupResult *)result2;
}
@end
Another framework imports the Obj-C++ framework. In this framework the protocol is defined in Swift with an associated type:
public protocol ResultComparable
{
associatedtype ResultType
func compareQueryResult(_ r1: ResultType, toQueryResult r2: ResultType) -> ComparisonResult
}
And conformance is declared:
extension DocumentQuery: ResultComparable {}
extension GroupQuery: ResultComparable {}
This compiled without warnings in Xcode 8 / Swift 3, but they appear in Xcode 9 / Swift 3. Any help in understanding the issue and how to fix it would be greatly appreciated.
James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170915/12318a7b/attachment.html>
More information about the swift-users
mailing list