Hi, I have the new Xcode 11.4.1 with what I think is swift 5.1. What is the correct code for hiding a UIButton?

Hi, I have the new Xcoder 11.4.1 with what I think is swift 5.1.



I am trying to hide a button (UIButton) with the known button.hidden=true / button.isHidden=true/ button.alpha=0 but none seem to work.

I get the error

Value of type '(UIButton) -> ()' has no member 'isHidden'

same for hidden and alpha.





What is the correct code to hide buttons in this version? Thanks

Replies

Xcode 11.4.x runs Swift 5.2


When sharing code, pls, use the <> brackets in the editor. See For Best Results - Read the Label


Try:

.isHidden(true)

What is button ? How did you define and set it ?

Maybe you use a closure and forgot the () at the end of closure (after closing curly brace).


For an error message as

Value of type '(UIButton) -> ()' has no member 'isHidden'


shows it is not a UIButton, but some func.


I tested button.isHidden = true

which works no problem in 11.4.1