[Solved] Not able to assign text to UITextView


Providing more error details might help to solve your issue. But you can still solve it by checking few things-:

1) Check for UITextView outlet in storyboard-:

enter image description here

2) Check if you have given correct class to controller . In my case it’s UnderlineViewController check for yours. Your controller should have same class.

2.a) Go to storyboard click on controller and select identity inspector.

2.b) check class name.

enter image description here

Now add text in controller class-:

import UIKit

class UnderlineViewController: UIViewController {

    @IBOutlet weak var textViewData: UITextView!

    override func viewDidLoad() {
        super.viewDidLoad()
        textViewData.text = "Tushar"
        }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

OUTPUT-:

enter image description here

MAKE SURE YOU HAVE NO MORE THEN 1 OUTLET FOR ANY VIEW IN SIMILAR
CONTROLLER.

0

solved Not able to assign text to UITextView