Swiftpack.co - Package - tigerpixel/Currier

Currier

Build Status Version Platform Carthage compatible License

Currier transforms any Swift function into a curried version of that function. This is achieved by wrapping it in a simple 'curry' call.

Given the following function:

func myMultiply(first: Float, second: Int) -> Double {
    return Double(first) * Double(second)
}

Currier will produce a curried version:

let curriedMultiply: (Float) -> (Int) -> Double = curry(myMultiply) // Currier used here!

let multiplyByTwo: (Int) -> Double = curriedMultiply(2.0) // Partial application

let result: Double = multiplyByTwo(10)

assert(20 == result) // Assertion true

The previous example can be condensed down to the following:

let sameResult = curry(myMultiply)(2.0)(10)

The unit tests provide examples of calling the curry function using different numbers of parameters. The version of the function which takes two parameters is explicitly typed and commented.

Requirements

There are no external requirements for this project, just Swift.

  • iOS 8.0+ / macOS 10.9+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 11+
  • Swift 5.1+

For older versions of Swift and Xcode, please see prior releases.

Installation

Swift Package Manager

The Swift Package Manager is the official tool for managing the distribution of Swift code. It is currently only available for all Apple platforms. It can also be used with Linux but this project does not fully support that at this point.

If you use it to manage your dependencies, simply add Currier to the dependencies value of your Package.swift file.

dependencies: [
.package(url: "https://github.com/tigerpixel/Currier.git", from: "1.3.0")
]

Cocoapods

Currier is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Currier"

Carthage

If you use Carthage to manage your dependencies, simply add the following line to your Cartfile:

github "tigerpixel/Currier"

If you use Carthage to build your dependencies, make sure you have added Currier.framework to the "Linked Frameworks and Libraries" section of your target, and have included them in your Carthage framework copying build phase.

Git Submodule

  1. Add the Currier repository as a submodule of your application’s repository.
  2. Run git submodule update --init --recursive from within the Currier folder.
  3. Drag and drop Currier.xcodeproj into your application’s Xcode project or workspace.
  4. On the “General” tab of your application target’s settings, add Currier.framework. to the “Embedded Binaries” section.
  5. If your application target does not contain Swift code at all, you should also set the EMBEDDED_CONTENT_CONTAINS_SWIFT build setting to “Yes”.

MIT License

Currier is available under the MIT license. Details can be found within the LICENSE file.

Github

link
Stars: 1

Dependencies

Used By

Total: 1

Releases

Swift 5.1 and Xcode 11 - 2019-09-30 21:16:49

Update to Swift Package Manager to make compatible with Swift 5.1. Added Swift Package Manager capabilities to all platforms. Updated Swift code to take advantage of Swift 5.1 features. Swiftlint version update to 0.35.0.

Swift 5 and Xcode 10.3 with SPM - 2019-08-20 22:03:01

Patch version to ensure that Swift Package Manager builds with the latest tools. Only required for Mac users building with SPM. It will not be sent to Cocoapods as it is not required by Cocoapods users.

Swift 5 and Xcode 10.3 - 2019-08-18 08:58:02

Swift 5 and Xcode 10.3 SwiftLint 0.34.0

Swift 4 and Xcode 9.0 - 2017-09-27 20:45:54

Updates build for Swift language version 4. Updates the version of Xcode used to build the project to 9.0 Updates the version of Swiftlint used to 0.22.0

Initial Release for Swift 3.1 - 2017-09-18 23:13:47

Initial release for Swift 3.1

Update to Swift 3.1 build with Xcode 8.3 - 2017-09-17 08:32:17

Updates the build to work with Swift 3.1 and Xcode 8.3.

No code changes, just an update to the build settings and documentation.

Available for Swift Package Manager - 2017-03-15 13:56:48

Now available for Swift Package Manager.

Added Documentation to code.

Fixed issue with Mac build for Carthage.

Added Cocoapods podspec lint to travis CI.

Update to README for cocoapods pretty display. - 2017-03-09 09:49:58

Update to README for cocoapods pretty display.

Improves layout for Cocoapods page.

This update contains no code level changes.

Targets added for Mac, Apple Watch and Apple TV - 2017-03-08 20:41:38

Targets added for Mac, Apple Watch and Apple TV.

Lower deployment target for iOS.

Currying functions with up to 14 parameters included. This has increased from 12.

Cocoapods and Github descriptions updated.

Sheilds added to Github page.

Initial Beta - 2017-02-26 00:51:54

An initial beta version with the basic content of the library in usable and unit tested state.