AddCaseBoolean

main

Swift macro to generate `isCaseName: Bool` property for enum case that have associated value.
r-plus/AddCaseBoolean

AddCaseBoolean

A Swift macro that generate isCaseName: Bool computed properties per enum case that have associated value.

for example below source code

@AddCaseBoolean
enum E {
    case simple
    case foo(Int)
}

will generate isFoo computed property.

var isFoo: Bool {
    if case .foo = self {
        return true
    }
    return false
}

Install

.package(url: "https://github.com/r-plus/AddCaseBoolean.git", from: "0.0.1")

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

Last updated: Sun Oct 20 2024 08:45:54 GMT-0900 (Hawaii-Aleutian Daylight Time)