I have mainStack
as a UIStackView
. This stack contains 4 UIStackViews
. Each of these two 4 stacks contain 2 buttons. I am trying to locate these buttons by enumeration, using this code:
// get the subviews of the main stack
let subviews = mainStack!.arrangedSubviews as Array
// enumerate each one
for subStack in subviews as UIStackView { // 1
let buttons = subStack.subvies
}
I have an error on //1
with the message:
Cannot convert value of type '[UIView]' to type 'UIStackView' in coercion
Why is that? The subviews of the main stack are UIStackViews
.are
any ideas?