 
 fileprivate extension MessageLabel {
 
-    var textAttributes: [NSAttributedStringKey: Any]? {
+    var textAttributes: [NSAttributedStringKey: Any] {
         let length = attributedText!.length
         var range = NSRange(location: 0, length: length)
-        return attributedText?.attributes(at: 0, effectiveRange: &range)
+        return attributedText!.attributes(at: 0, effectiveRange: &range)
     }
 }

                    messageLabel.text = "1-800-555-1234"
                    messageLabel.enabledDetectors = [.phoneNumber]
                    let attributes = messageLabel.textAttributes
                    let textFont = attributes?[.font] as? UIFont
                    expect(textFont).toNot(beNil())
                    expect(textFont).to(equal(expectedFont))
                }
            }

                    messageLabel.text = "One Infinite Loop Cupertino, CA 95014"
                    messageLabel.enabledDetectors = [.address]
                    let attributes = messageLabel.textAttributes
                    let textColor = attributes[.foregroundColor] as? UIColor
                    expect(textColor).to(equal(expectedColor))
                }
            }
