I have this code which works well:
public protocol PermissionProvider {
static func authorizationStatus(for mediaType: AVMediaType) -> AVAuthorizationStatus
}
extension AVCaptureDevice: PermissionProvider {}
Now I need to expose the protocol to Objc runtime:
@objc // added this attribute
public protocol PermissionProvider {
static func authorizationStatus(for mediaType: AVMediaType) -> AVAuthorizationStatus
}
extension AVCaptureDevice: PermissionProvider {}
But I got an error saying:
AVFoundation.AVCaptureDevice:4:21: error: Objective-C method 'authorizationStatusForMediaType:' provided by method 'authorizationStatus(for:)' does not match the requirement's selector ('authorizationStatusFor:')
open class func authorizationStatus(for mediaType: AVMediaType) -> AVAuthorizationStatus
From the error message, it looks like related to some naming convention between objc and swift. I wonder how i can fix the compile error?
The reason I introduced this protocol is that, I need to unit test and inject this "permission provider". And the reason I need to expose it to objc is that, some of the caller is still in ObjC
Edit:
I created an empty project, then created a new file with the above code, and got the error

@objcto the protocol does it give you the error? @Paulw11extension AVCaptureDevice: PermissionProvider {}