A functional tool-belt for Swift Language similar to Lo-Dash or Underscore.js in Javascript
Dollar and Cent - Underscore.js for Swift
Here's a function from the Dollar framework for Swift:
public class func bind<T, E>(function: (T...) -> E, _ parameters: T...) -> (() -> E) {
return { () -> E in
typealias TType = (T...)
return function(unsafeBitCast(parameters, TType.self))
}
}
In the line with the typealias
I get the Cannot create a variadic tuple
error. When I remove the braces around T...
then I receive the Consecutive statements on a line must be separated by ';'
error. So, this is not a solution.
Does anyone know a workaround to get the error away?
This happens since XCode 6 Beta 6, which was (really) released today.
Source: (StackOverflow)
This probably has a simple answer but i just cant seem to find it,
Basically i want to be able to split an array up into blocks of six arrays, i can't seem to find any easy way to do it.
I've been using a method from https://github.com/ankurp/Dollar.swift
$.partitionAll(arrayToSplit, n:6, step: 6)
Which works great, but my app will only be usable on iOS8
Source: (StackOverflow)