-4

Why isn't it possible to declare functions with same name in a UIViewController

Methods with same name in ViewController

but it is possible to declare functions with the same name in other classes

Methods with same name in other class

Jojodmo
  • 23,357
  • 13
  • 65
  • 107
kamran2142
  • 213
  • 1
  • 2
  • 6

1 Answers1

3

The class that it works in is a Swift native class, which supports having function inputs that are differentiated only by their types (with same names).

The other class inherits from UIViewController, which means it is bridged to Objective-C, which means it must be able to be called from Objective-C code. Objective-C does NOT allow this functionality, so that is why you have red arrows.

sschale
  • 5,168
  • 3
  • 29
  • 36