When doing macOS or iOS programming, a common use-case I have for interspersed is to insert a separator or divider view in-between a bunch of other views.
Example, given an array of views, I'd like to insert a separator view in-between each one:
let views = [view1, view2, view3]
let allViews = views.interspersed(using: { SeparatorView() })
Expected:
[view1, separator1, view2, separator2, view3]
Because these are NSView, the inserted element needs to be a new instance each time, which the existing implementation does not appear to offer.
When doing macOS or iOS programming, a common use-case I have for
interspersed
is to insert a separator or divider view in-between a bunch of other views.Example, given an array of views, I'd like to insert a separator view in-between each one:
Expected:
[view1, separator1, view2, separator2, view3]
Because these are NSView, the inserted element needs to be a new instance each time, which the existing implementation does not appear to offer.