         return textStorage
     }()
 
-    private lazy var rangesForDetectors: [DetectorType: [(NSRange, Any?)]] = [:]
+    private lazy var rangesForDetectors: [DetectorType: [(NSRange, MessageTextCheckingType)]] = [:]
 
     // MARK: - Public Properties
 

        for result in checkingResults {

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


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