0

I am trying to create two methods with the following arguments but the compiler is complaining that they are ambiguous. I am following a youtube series to learn Swift and it seems to be fine in the video there. What am I missing?

func performOperation(operation: Double -> Double){

func performOperation(operation:(Double, Double)->Double){

AD.Net
  • 13,352
  • 2
  • 28
  • 47

1 Answers1

1

It seems you may be running into the same problem mentioned in this reddit thread. It looks like the solution may just be to rename your functions, due to a clash with inherited with Objective C methods.

e.g.

func myPerformOperation(operation: Double -> Double){

func myPerformOperation(operation:(Double, Double)->Double){

(These aren't ideal names—they should be more descriptive—but you get the idea.)

Cory W.
  • 307
  • 2
  • 9