I have array [["PT"], ["GE", "DE", "PL", "BY"], ["CZ", "US"]]
and I'd like to use it in UISegmentedControl
that I created programmatically:
for i in 0..<array.count {
mySegmentControl.insertSegment(withTitle: array[i], at: i, animated: false)
}
I see error:
Cannot convert value of type '[String]' to expected argument type 'String?'
It's true, But I need that PT
would be at first segment title, GE..BY
at second and etc.
What's the type of array? Is it [[String]], then you can do this (Playground code):