Reputation: 309
[[XHAudioPlayerHelper shareInstance] setDelegate:(id<NSFileManagerDelegate>)self];
I want to translate this OC to swift.
I tried that :
XHAudioPlayerHelper.shareInstance().delegate = self as! NSFileManagerDelegate
But couldn't compiled with error of : ambiguous use of delegate,
Upvotes: 0
Views: 95
Reputation: 100662
Does shareInstance
perchance return an object of type id
? In that case the compiler would have no idea what type it is getting and hence which type of delegate is expected.
If so then amend it to return instancetype
if possible; as a fallback perform something like:
let sharedInstance = XHAudioPlayerHelper.shareInstance() as! XHAudioPlayerHelper
sharedInstance.delegate = ...
Upvotes: 2