github pointfreeco/swift-case-paths 1.4.0

latest releases: 1.7.2, 1.7.1, 1.7.0...
15 months ago

What's Changed

  • Added: A @CasePathable instance can now be used to look up its associated case path (#158).

    @CasePathable
    enum Foo {
      case bar(Int)
      case baz(String)
    }
    
    let baz = Foo.baz("Blob")
    let bazCase = Foo.allCasePaths[baz]  // PartialCaseKeyPath<Foo>
    baz.is(bazCase)  // true
  • Added: A @CasePathable enum can now iterate over all of its case key paths (#159).

    @CasePathable
    enum Foo {
      case bar(Int)
      case baz(String)
    }
    
    let baz = Foo.baz("Blob")
    for casePath in Foo.allCasePaths {
      print(baz.is(casePath))
    }
    // false
    // true
    let casePaths = Array(Foo.allCasePaths)  // [PartialCaseKeyPath<Foo>]
    casePaths == [\.bar, \.baz]  // true
  • Infrastructure: Strict concurrency has been enabled in preparation for Swift 6 (#156).

Full Changelog: 1.3.3...1.4.0

Don't miss a new swift-case-paths release

NewReleases is sending notifications on new releases.