0

I am a beginner swift developer and I am trying to migrate my app to Swift 3.

I keep having this error and don't know how to solve it. "Argument labels '(_:)' do not match any available overloads"

I am using Swift Validator and my code seems to be the same as the proposed one. https://github.com/jpotts18/SwiftValidator

My issue is possibly similar to those ones:

similar issue 1

similar issue 2

Do you have any idea? Thanks a lot

class UpdateContactViewController: UIViewController, UITableViewDelegate, UITableViewDataSource,ValidationDelegate, UITextFieldDelegate {
@available(iOS 2.0, *)
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

}


let validator = Validator()
let realm = try! Realm()
var contact_identifier = "1"
var lastSelectedIndexPath: NSIndexPath?
@IBAction func save_button_hit(sender: AnyObject) {
    // text field validator
    validator.validate(self)
}

The error is highlighting "validator.validate(self)"

Thanks for your help

Community
  • 1
  • 1
Quentin Del
  • 1,485
  • 2
  • 18
  • 32
  • Possible duplicate of [Argument labels '(\_:)' do not match any available overloads](http://stackoverflow.com/questions/41091776/argument-labels-do-not-match-any-available-overloads) – swillsea Feb 07 '17 at 22:36
  • 1
    The github you reference shows that you have to register all of the text fields you are interested in before calling the `validate(self)` function. You don't show that code above ... – Russell Feb 07 '17 at 23:11

2 Answers2

2

Remember that Swift 3 introduced mandatory labels for the parameters in a method call. So a call that was previously done as:

elem.perform(a)

is now done:

elem.perform(parameterName: a)

So the correct would be the following:

validator.validate(delegate: self)

Federico Ojeda
  • 758
  • 7
  • 11
0

Here is how to fix the issue: validator.validate(delegate: self)

Quentin Del
  • 1,485
  • 2
  • 18
  • 32