Siyao Li Siyao Li - 6 months ago 29
Swift Question

How to clear the content of a label with code in swift?

I want to clear the content of a label with swift code when the simulator first start, not with the interface builder of Xcode. How do I do that? Anybody can help me out? Thanks!

Answer

You can use:

textLabel.text = nil

since textLabel.text is a Optional String.