@@ -46,8 +46,7 @@ final class MessageLabelSpec: QuickSpec {
4646 messageLabel. text = " One Infinite Loop Cupertino, CA 95014 "
4747 messageLabel. enabledDetectors = [ . address]
4848 let attributes = messageLabel. textAttributes
49- let textColor = attributes ? [ . foregroundColor] as? UIColor
50- expect ( textColor) . toNot ( beNil ( ) )
49+ let textColor = attributes [ . foregroundColor] as? UIColor
5150 expect ( textColor) . to ( equal ( expectedColor) )
5251 }
5352 }
@@ -58,8 +57,7 @@ final class MessageLabelSpec: QuickSpec {
5857 messageLabel. text = " 1-800-555-1234 "
5958 messageLabel. enabledDetectors = [ . phoneNumber]
6059 let attributes = messageLabel. textAttributes
61- let textFont = attributes ? [ . font] as? UIFont
62- expect ( textFont) . toNot ( beNil ( ) )
60+ let textFont = attributes [ . font] as? UIFont
6361 expect ( textFont) . to ( equal ( expectedFont) )
6462 }
6563 }
@@ -70,8 +68,7 @@ final class MessageLabelSpec: QuickSpec {
7068 messageLabel. text = " https://github.com/MessageKit "
7169 messageLabel. enabledDetectors = [ . url]
7270 let attributes = messageLabel. textAttributes
73- let textColor = attributes ? [ . foregroundColor] as? UIColor
74- expect ( textColor) . toNot ( beNil ( ) )
71+ let textColor = attributes [ . foregroundColor] as? UIColor
7572 expect ( textColor) . to ( equal ( expectedColor) )
7673 }
7774 }
@@ -82,8 +79,7 @@ final class MessageLabelSpec: QuickSpec {
8279 messageLabel. text = " Today "
8380 messageLabel. enabledDetectors = [ . date]
8481 let attributes = messageLabel. textAttributes
85- let textFont = attributes ? [ . font] as? UIFont
86- expect ( textFont) . toNot ( beNil ( ) )
82+ let textFont = attributes [ . font] as? UIFont
8783 expect ( textFont) . to ( equal ( expectedFont) )
8884 }
8985 }
@@ -250,9 +246,9 @@ final class MessageLabelSpec: QuickSpec {
250246
251247fileprivate extension MessageLabel {
252248
253- var textAttributes : [ NSAttributedStringKey : Any ] ? {
249+ var textAttributes : [ NSAttributedStringKey : Any ] {
254250 let length = attributedText!. length
255251 var range = NSRange ( location: 0 , length: length)
256- return attributedText? . attributes ( at: 0 , effectiveRange: & range)
252+ return attributedText! . attributes ( at: 0 , effectiveRange: & range)
257253 }
258254}
0 commit comments