         case .underlineStyle: name = .underlineStyle
         case .writingDirections: name = .writingDirection
         case .verticalGlyphForm: name = .verticalGlyphForm
-        case .custom(let attributeName, _) where name == nil:
+        case .custom(let attributeName, _):
             name = NSAttributedString.Key(rawValue: attributeName)
-        default: break
         }
 
         return name

            let values: [Int] = validate(foundationValue)
            ret = .writingDirections(values.compactMap(WritingDirection.init))
        default:
            if ret == nil {
                ret = .custom(name.rawValue, foundationValue)
            }
        }

        self = ret

    // Convenience getter variable for the associated value of the attribute. See each case to determine the return type.
    public var value: Any {

        switch self {
        #if !os(watchOS)
            case .attachment(let attachment): return attachment
            case .shadow(let shadow): return shadow
        #endif
        #if os(macOS)
            case .cursor(let cursor): return cursor
            case .markedClauseSegment(let segment): return segment
            case .spellingState(let state): return state
            case .superscript(let superscript): return superscript
            case .textAlternatives(let alternatives): return alternatives
            case .toolTip(let text): return text
        #endif
        case .baselineOffset(let offset): return offset
        case .backgroundColor(let color): return color
        case .expansion(let expansion): return expansion
