Additions
-
Sequences have new
grouped(by:)
andkeyed(by:)
methods, which simplify building dictionaries based on sequence elements: (#197)let evensOdds = (1...10).grouped(by: { $0.isMultiple(of: 2) ? "even" : "odd" }) // ["even": [2, 4, 6, 8, 10], "odd": [1, 3, 5, 7, 9]] let animals = ["Aardvark", "Alpaca", "Armadillo", "Barracuda", "Buffalo", ...] let alphaAnimals = animals.keyed(by: \.first!, resolvingConflictsWith: { _, first, _ in first }) // ["A": "Aardvark", "B": "Barracuda", ...]
-
The
endOfPrefix(while:)
andstartOfSuffix(while)
methods are now public. These methods were previously implementation details of thetrimming
group of methods. (#211)
Fixes
The 1.2.0 release includes contributions from @amomchilov, @mattyoung, @natecook1000, @stephentyrone, and @ttsugriy.
Thank you!