Skip to content

Releases: RougeWare/Swift-Collection-Tools

3.2 - Element + Collection

25 Nov 09:21
1918c72
Compare
Choose a tag to compare

We already had integers + 7, now we also have 7 + integers!

3.1 - Added @ArrayBuilder

12 Jun 07:33
5ee6a70
Compare
Choose a tag to compare

@ArrayBuilder is a basic result builder which transforms all of its children into an array. This can be used to great effect when needing to use logic while building an array, like this:

self.tabsArray = Array {
   homeTab
   searchTab
    if !isGuestMode {
        profileTab
    }
    settingsTab
}

3.0.0 - Changed some of the new map APIs

04 Nov 23:05
9e7a9f2
Compare
Choose a tag to compare

2.3.0 introduced some new map APIs which take a transformer function. Two of them were ambiguous in many circumstances without explicit type declaration, which doesn't work well in Swift. So, I removed the one that's only for lazy collections and made the one for all collections always-lazy.

2.3.0 - Added map variants which take member functions

21 Oct 06:51
edbe4e2
Compare
Choose a tag to compare

I have no idea why this isn't in the standard library nor Foundation, but I often find myself wanting to do something like this:

["Vivien", "Marlon", "Kim", "Karl"].map(String.lowercased)

Now I can! With any collection type, into any collection type.

2.2.0 - Added many small tools

06 Aug 00:52
66cae0a
Compare
Choose a tag to compare

This update adds these small tools:

  • isNotEmpty - Simply an inverse of isEmpty, for terse and clear code. Inlined so you never worry about this bloating your executable
  • nonEmptyOrNil - Iff the collection is empty, this returns nil, otherwise it returns the collection. Useful for leveraging APIs whose behavior changes based on a value's optionality, such as guard or ??
  • onlyFirst(_:) - Returns only the first k values of the collection. This uses dropLast(_:) under the hood for performance.
  • onlyLast(_:) - Returns only the last k values of the collection. This uses dropFirst(_:) under the hood for performance.
  • + - Range-replaceable collections have this to concatenate two collections together. This lets you simply concatenate one element to the end of an existing range-replaceable collection.
  • += - The same as +, but mutates the left-hand-side, rather than returning a new collection

2.1.0 - Introduced `.sequentialPairs`

03 Aug 01:03
8b493d5
Compare
Choose a tag to compare

This allows you to lazily consume any sequence as a series of its ordered pairs

2.0.0 - Reworked `everyPairWithoutDuplicates` and `mapEveryPair`

21 Jun 21:28
f0a52d2
Compare
Choose a tag to compare

These no longer return a generic collection, but instead always return the same kind of lazy version of the current collection. Also added variants to everyPairWithoutDuplicates which allow you to use them when the collection elements aren't Equatable!

1.1.0 - `withoutDuplicates`

21 Jun 08:57
7cbfdc7
Compare
Choose a tag to compare

Added withoutDuplicates() to filter out duplicate elements

1.0.0 - MVP

20 Jun 21:42
475eaa2
Compare
Choose a tag to compare

Starting with something simple: everyPair and CollectionWhichCanBeEmpty