user2901530
user2901530

Reputation:

Swift 'text' is unavailable: APIs deprecated as of iOS7. textLabel does not work

I keep having this error

I've seen other questions been answered by using textLabel.text, but it doesn't work in my case

enter image description here

I'm new to swift so could someone please explain me why and how to solve this.

Upvotes: 0

Views: 2758

Answers (1)

Zoyt
Zoyt

Reputation: 4967

You need to unwrap textLabel by using an ! after textLabel.

This is because textLabel is an Optional (hence the textLabel? type instead of just textLabel). Read more about optionals here.

Hope that helps!

Upvotes: 2

Related Questions