-2

I want to create a dropdown in swift, trying the following code:

import UIKit

class DataUser: UIViewController {
    @IBOutlet weak var btnDtop: UIButton!

    @IBOutlet weak var tblView: UITableView!

    var movinghouses = ["apple","coooasnk","scnaon","dojcncn"]

     override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    @IBAction func onClickDropButton(_ sender: Any) {
    }


}

extension DataUser : UITableViewDelegate, UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return movinghouses.count
        }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
        cell.textLabel?.text = movinghouses[indexPath.row]
        return cell
    }

}

When I do, an error occurs in code, that states: "Thread 1: signal SIGABR". How could I fix it?

RajeshKumar R
  • 15,445
  • 2
  • 38
  • 70
  • 1
    Possible duplicate of [Making a drop down list using swift?](https://stackoverflow.com/questions/30319718/making-a-drop-down-list-using-swift) – Muhammad Mehar May 21 '19 at 22:28

1 Answers1

0

SIGABRT errors in this context are often the result of a broken connection between a UI element and an outlet. Try cleaning the project, and if that doesn't work check your UIButton's connections and make sure they haven't been changed or deleted. See this post or this article for more information on how to do this.

blorsch
  • 70
  • 1
  • 9