https://kotlinlang.org logo
#ios
Title
# ios
p

phldavies

03/19/2020, 11:29 AM
When implementing an ObcJ protocol, how can you work around conflicting overloads? For example, implementing
Copy code
override fun locationManager(manager: CLLocationManager, didEnterRegion: CLRegion) 
override fun locationManager(manager: CLLocationManager, didExitRegion: CLRegion)
override fun locationManager(manager: CLLocationManager, didStartMonitoringForRegion: CLRegion)
r

ribesg

03/19/2020, 11:38 AM
I would also like to know this. I don’t need it yet, and hopefully I never need it because I don’t think it’s possible at all right now
t

Thomas

03/19/2020, 11:44 AM
Add
@Suppress("CONFLICTING_OVERLOADS")
to your class and it will work. It should be documented somewhere as well.
p

phldavies

03/19/2020, 11:49 AM
Perfect, thanks - I skimmed that a few days ago when starting out, but I obviously missed that.
r

ribesg

03/19/2020, 11:50 AM
You can suppress errors? Nice
l

louiscad

03/19/2020, 3:52 PM
You can also make the suppress string literal lowercase.
r

ribesg

03/25/2020, 1:16 PM
I have follow up questions: how do I suppress this error and how do I know what the “code” is for errors to suppress them?
t

Thomas

03/27/2020, 8:46 PM
I am not sure about your error. I haven't run into this situation yet.
p

phldavies

04/01/2020, 10:22 AM
Have you tried adding an empty implementation for the referenced method (that returns
Boolean
) and suppressing the conflicting overloads?
r

ribesg

04/01/2020, 10:34 AM
The IDE never suggests to suppress errors, only warnings, I’m asking for the way to know what to suppress (the error identifier)
Like in this example, how to I know the code is
CONFLICTING_OVERLOADS
? Is there a list somewhere?
I still don’t know how to suppress “return type is not a subtype...” I can’t find the identifier
2 Views