https://github.com/curatoopensource/arrayplustuple
Simple extension that makes creating tuples from arrays a breeze.
https://github.com/curatoopensource/arrayplustuple
Last synced: about 1 year ago
JSON representation
Simple extension that makes creating tuples from arrays a breeze.
- Host: GitHub
- URL: https://github.com/curatoopensource/arrayplustuple
- Owner: CuratoOpenSource
- License: mit
- Created: 2018-06-02T13:50:40.000Z (almost 8 years ago)
- Default Branch: develop
- Last Pushed: 2020-11-03T16:01:53.000Z (over 5 years ago)
- Last Synced: 2024-03-15T13:44:21.948Z (about 2 years ago)
- Language: Swift
- Size: 262 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ArrayPlusTuple
[](http://cocoapods.org/pods/Zoomy) [](http://cocoapods.org/pods/Zoomy) [](LICENSE)
Simple [extension](https://github.com/lvnkmn/ArrayPlusTuple/blob/develop/ArrayPlusTuple/Classes/Array%2Btuple.swift) that makes creating tuples from arrays a breeze.
Originally created for [Mock 'N Stub](https://github.com/lvnkmn/Mock-N-stub).
## Setup
Just add:
```Swift
import ArrayPlusTuple
```
to the files where you need tuples from arrays.
## Example
Non optional Any:
```Swift
let tuple = [1, 2, "three"].tuple
```
Typed optional:
```Swift
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.

### Need support for more elements?
Create a [feature request](https://github.com/lvnkmn/ArrayPlusTuple/issues/new) and it will likely be picked up.
Or [add it yourself](https://github.com/lvnkmn/ArrayPlusTuple/blob/develop/ArrayPlusTuple/Classes/Array%2Btuple.swift) and create a pull request, if the [tests](http://htmlpreview.github.io/?https://github.com/lvnkmn/ArrayPlusTuple/blob/develop/fastlane/test_output/report.html) pass i'll merge it.
## Installation
ArrayPlusTuple is available through [Swift Package Manager](https://swift.org/package-manager/). To install it, simply add it to your project using this repository's URL as explained [here](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app).
## License
ArrayPlusTuple is available under the MIT license. See the LICENSE file for more info.