Swiftpack.co - CuratoOpenSource/ArrayPlusTuple as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by CuratoOpenSource.
CuratoOpenSource/ArrayPlusTuple 2.1.0
Simple extension that makes creating tuples from arrays a breeze.
⭐️ 2
🕓 3 years ago
iOS
.package(url: "https://github.com/CuratoOpenSource/ArrayPlusTuple.git", from: "2.1.0")

ArrayPlusTuple

Version Platform License

Simple extension that makes creating tuples from arrays a breeze.

Originally created for Mock 'N Stub.

Setup

Just add:

import ArrayPlusTuple

to the files where you need tuples from arrays.

Example

Non optional Any:

let tuple = [1, 2, "three"].tuple

Typed optional:

let tuple = [1, 2, "three"].tuple as? (Int, Int, String)

Larger arrays

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.

Screenshot Missing

Need support for more elements?

Create a feature request and it will likely be picked up.

Or add it yourself and create a pull request, if the tests pass i'll merge it.

Installation

ArrayPlusTuple is available through Swift Package Manager. To install it, simply add it to your project using this repository's URL as explained here.

License

ArrayPlusTuple is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 2
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

4 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics