 
     private func detectorAttributes(for checkingResultType: NSTextCheckingResult.CheckingType) -> [NSAttributedStringKey: Any] {
         switch checkingResultType {
-        case NSTextCheckingResult.CheckingType.address:
+        case .address:
             return addressAttributes
-        case NSTextCheckingResult.CheckingType.date:
+        case .date:
             return dateAttributes
-        case NSTextCheckingResult.CheckingType.phoneNumber:
+        case .phoneNumber:
             return phoneNumberAttributes
-        case NSTextCheckingResult.CheckingType.link:
+        case .link:
             return urlAttributes
         default:
             fatalError("Received an unrecognized NSTextCheckingResult.CheckingType")

    }
    
}

        for result in checkingResults {

            switch result.resultType {
            case .address:
                var ranges = rangesForDetectors[.address] ?? []
                let tuple: (NSRange, MessageTextCheckingType) = (result.range, .addressComponents(result.addressComponents))
                ranges.append(tuple)
                rangesForDetectors.updateValue(ranges, forKey: .address)
            case .date:
                var ranges = rangesForDetectors[.date] ?? []
                let tuple: (NSRange, MessageTextCheckingType) = (result.range, .date(result.date))
                ranges.append(tuple)
                rangesForDetectors.updateValue(ranges, forKey: .date)
            case .phoneNumber:
                var ranges = rangesForDetectors[.phoneNumber] ?? []
                let tuple: (NSRange, MessageTextCheckingType) = (result.range, .phoneNumber(result.phoneNumber))
                ranges.append(tuple)
                rangesForDetectors.updateValue(ranges, forKey: .phoneNumber)
            case .link:
                var ranges = rangesForDetectors[.url] ?? []
                let tuple: (NSRange, MessageTextCheckingType) = (result.range, .link(result.url))
                ranges.append(tuple)
                rangesForDetectors.updateValue(ranges, forKey: .url)
            default:
