Simple extension that makes creating tuples from arrays a breeze.
Originally created for Mock 'N Stub.
to the files where you need tuples from arrays.
Non optional Any:
let tuple = [1, 2, "three"].tuple
let tuple = [1, 2, "three"].tuple as? (Int, Int, String)
ArrayPlusTuple currently supports creating tuples from arrays with up to 24 elements.
When creating tuples from arrays with more than 24 elements, a warning will be logged and a tuple with the first 24 elements of the array is still returned.
Need support for more elements?
Create a feature request and it will likely be picked up.
ArrayPlusTuple is available through CocoaPods. To install it, simply add the following line to your Podfile:
ArrayPlusTuple is available under the MIT license. See the LICENSE file for more info.