You just need to change one or both of those parameter names in your code. The argument labels (didSelectTab and previousTab) are part of the method signature and need to match the protocol declaration, but the parameter names can be whatever you want.
I’d recommend this:
func tabBarController(
_ tabBarController: UITabBarController,
didSelectTab selectedTab: UITab, // better parameter name
previousTab: UITab? // no custom parameter name needed
)
(Or you can omit tabBarController and selectedTab entirely if you don’t actually use them in your code.)
Also consider entering a Feedback to report that the method declaration in the SDK is poorly formed. Presumably your error came after letting Xcode auto-generate the method for you based on its declaration. So it would be better if the SDK declaration were formed like my proposal above.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: