Swiftpack.co - gringoireDM/EnumKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by gringoireDM.
gringoireDM/EnumKit 1.1.3
EnumKit is a library that gives you the ability to simply access an enum associated value, without having to use pattern matching. It also offers many utilities available to other swift types, like updatability of an associated value and transformations.
⭐️ 102
🕓 3 years ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/gringoireDM/EnumKit.git", from: "1.1.3")

EnumKit

Build Status codecov Swift Package Manager cocoapods

EnumKit is a library that gives you the ability to simply access an enum associated value, without having to use pattern matching. It also offers many utilities available to other swift types, like updatability of an associated value and transformations.

EnumKit comes with an extension of Sequence to extend functions like compactMap, flatMap, filter to Sequences of enums cases.

All you need to do to get these features is to declare your enum conformant to the marker protocol CaseAccessible.

enum MyEnum: CaseAccessible { ... }

For more please read our wiki.

Usage

Requirements

V 1.0.0

  • Xcode 10.2
  • Swift 5.0

V 1.1.0

  • Xcode 11
  • Swift 5.1

Installation

EnumKit offers cocoapods and swiftPM

Via Cocoapods

# Podfile
use_frameworks!

target 'YOUR_TARGET_NAME' do
    pod 'EnumKit', '~> 1.1.0'
end

Replace YOUR_TARGET_NAME and then, in the Podfile directory, type:

$ pod install

via Swift Package Manager

Create a Package.swift file.

// swift-tools-version:5.1

import PackageDescription

let package = Package(
  name: "YourProjectName",
  dependencies: [
    .package(url: "https://github.com/gringoireDM/EnumKit.git", from: "1.1.0")
  ],
  targets: [
    .target(name: "YourProjectName", dependencies: ["EnumKit"])
  ]
)
$ swift build

External Resources

GitHub

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

Related Packages

Release Notes

4 years ago

Introduced CaseAccessible protocol to easy match enum cases, access and transform associated values, and conditionally execute a block of code when a enum case match a specific enum pattern.

This release also add an extension for Sequence to easily filter and transform enum cases.

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