Disable text field interaction with segue

Disable text field interaction with segue

I want to make textfield's user interaction disabled when the user tapped on tableview's row and the segue is applied.Where did I something wrong ? I am getting "Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value" error when I select row at tableview.

I want to make textfield's user interaction disabled when the user tapped on tableview's row and the segue is applied.Where did I something wrong ? I am getting "Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value" error when I select row at tableview.

here is my ViewController class and its necessary functions

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    self.selectedTrip = dateArray[indexPath.row]
    performSegue(withIdentifier: "toDetailsVC", sender: self)
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "toDetailsVC" { let destinationVC = segue.destination as! detailsViewController destinationVC.kmField.isUserInteractionEnabled = false } }

and kmField in detailsVC is like

@IBOutlet weak var kmField: UITextField!


ios swift

What's new in Bootstrap 5 and when Bootstrap 5 release date?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Random Password Generator Online

HTML Color Picker online | HEX Color Picker | RGB Color Picker

Hire Dedicated Swift Developers

Want to create a native iOS application for your Startup? **[Hire Dedicated Swift Developers](https://hourlydeveloper.io/hire-dedicated-swift-developer/ "Hire Dedicated Swift Developers")** for end-to-end services like development, migration...

iOS App Development: How Apple's iOS 13 & Swift 5 Will Change App Development Industry

Want to know how Apple's iOS 13 & Swift 5 will change the iOS app development industry? Refer to this blog that contains in-detail information on it.

Easy way to save the class object in user defaults - Swift iOS

Easy way to save the class object in user defaults - Swift iOS Text tutorial: http://adnan-tech.com/easy-way-to-save-the-class-object-in-user-defaults-swift-...

The ultimate guide to iOS Unit Testing with Swift and Xcode

Unit testing is a testing method where you can test “unit” of code whether it is working as you want or not. In Xcode, use XCTest…

How to upload single and multiple images in iOS Swift, PHP and MySQL

How to upload single and multiple images in iOS Swift, PHP, and MySQL.