Skip to content

Instantly share code, notes, and snippets.

import CasePaths
public protocol CaseProviding {}
extension CaseProviding {
public subscript<Value>(casePath casePath: CasePath<Self, Value>) -> Value? {
get { casePath.extract(from: self) }
set {
guard let value = newValue else { return }
self = casePath.embed(value)