<div dir="ltr">Many times, I came across a scenario where I had to filter an array with a condition and filter the same array with opposite of that condition. For example:<div><br></div><div>let values = [2, 4, 3, 5, 6, 9]</div><div><br></div><div>let divisibleByTwo = values.filter { $0 % 2 == 0 }</div><div>let notDivisibleByTwo = values.filter { $0 % 2 != 0 }</div><div><br></div><div>Is there a way currently where we can filter the array into two arrays based on a condition?</div><div><br></div><div>If not how about something like a filterSplit function where we get a tuple of values:</div><div><br></div><div>values.filterSplit { $0 % 2 == 0 } = ([2,4,6], [3,5,9])</div><div><br></div><div>I have implemented this in our project and wanted to get your thoughts on it</div><div><br></div></div>