Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
How does one convert a 2D array to an array of sets in Swift, without using NSArray or NSSet?
I would like to go from [[UIView]] to var convertedSetsArray: [Set<UIView>]
[[UIView]]
var convertedSetsArray: [Set<UIView>]
Use something like this (assuming that views is an array of array of UIViews):
UIView
let result = views.map { Set($0) }
the type of views is [[UIView]], the result is Array<Set<UIView>>, so you didn't use any "NS" related types.
Array<Set<UIView>>
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.