Mildly-interesting pattern matching I found with associated value enums... I was not able to find anywhere mentioning this pattern, but I found this interesting pattern:

    enum TestEnum {
        case first(Int)
        case second(Int)

        var myNumber: Int {
            switch self {
                case .first(let num), .second(let num):
                    return num
            }
        }
    }

This seem to work if the cases take in the same number &amp; same type of associated value. I hope this is not a bug and an intended behavior.