Question: I have a `UISegmentedControl` that aims to toggle between 3 types of map views "Standard", ".Hybrid", and "Satellite". I am getting the following error on the line ".addTarget" Line.

> 
> "Editor placeholder in source file"
> 
> 
> 

```
    let  segmentedControl = UISegmentedControl(items: ["Standard", "Hybrid", "Satellite"])
    segmentedControl.backgroundColor = UIColor.white.withAlphaComponent(0.5)
    segmentedControl.selectedSegmentIndex = 0

    // EVENT LISTENER FOR SEGMENT CONTROL
    segmentedControl.addTarget(self, action: "mapTypeChanged:", for: .valueChanged)

    func mapTypeChanged(segControl: UISegmentedControl){
        switch segControl.selectedSegmentIndex{
        case 0:
            mapView.mapType = .standard
        case 1:
            mapView.mapType = .hybrid
        case 2:
            mapView.mapType = .satellite
        default:
            break
        }

    }

```

Answer: 
```
let  segmentedControl = UISegmentedControl(items: ["Standard", "Hybrid", "Satellite"])
segmentedControl.backgroundColor = UIColor.white.withAlphaComponent(0.5)
segmentedControl.selectedSegmentIndex = 0

// EVENT LISTENER FOR SEGMENT CONTROL
segmentedControl.addTarget(self, action: "mapTypeChanged:", for: .valueChanged)

func mapTypeChanged() //removing the auto complete params
{
    switch segControl.selectedSegmentIndex{
    case 0:
        mapView.mapType = .standard
    case 1:
        mapView.mapType = .hybrid
    case 2:
        mapView.mapType = .satellite
    default:
        break
    }

}

```

pls try with this..
A couple of things happening here. You need to use a **#selector** and change the declaration of your function to suppress the first argument naming, otherwise you would have to declare it also in the selector.

```
    let  segmentedControl = UISegmentedControl(items: ["Standard", "Hybrid", "Satellite"])
    segmentedControl.backgroundColor = UIColor.white.withAlphaComponent(0.5)
    segmentedControl.selectedSegmentIndex = 0

// EVENT LISTENER FOR SEGMENT CONTROL

segmentedControl.addTarget(nil, action: #selector(mapTypeChanged(_:)), for: .valueChanged)

func mapTypeChanged(_ segControl: UISegmentedControl){

    switch segControl.selectedSegmentIndex{
    case 0: mapView.mapType = .standard
    case 1: mapView.mapType = .hybrid
    case 2: mapView.mapType = .satellite
    default: break
    }
}

```