File tree Expand file tree Collapse file tree
Formatters/Implementations Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ class MarkFormatter: AttributeFormatter {
66 var placeholderAttributes : [ NSAttributedString . Key : Any ] ?
77 var textColor : String ?
88 var defaulTextColor : UIColor ?
9-
9+
1010 func applicationRange( for range: NSRange , in text: NSAttributedString ) -> NSRange {
1111 return range
1212 }
@@ -25,8 +25,8 @@ class MarkFormatter: AttributeFormatter {
2525 representationToUse = requestedRepresentation
2626 }
2727 resultingAttributes [ . markHtmlRepresentation] = representationToUse
28-
29- if ( textColor != nil ) {
28+
29+ if textColor != nil {
3030 resultingAttributes [ . foregroundColor] = UIColor ( hexString: textColor!)
3131 }
3232
@@ -35,8 +35,8 @@ class MarkFormatter: AttributeFormatter {
3535
3636 func remove( from attributes: [ NSAttributedString . Key : Any ] ) -> [ NSAttributedString . Key : Any ] {
3737 var resultingAttributes = attributes
38-
39- if ( defaulTextColor != nil ) {
38+
39+ if defaulTextColor != nil {
4040 resultingAttributes [ . foregroundColor] = defaulTextColor
4141 }
4242
Original file line number Diff line number Diff line change @@ -1163,14 +1163,14 @@ open class TextView: UITextView {
11631163
11641164 // If the format exists remove the current formatting
11651165 // this can happen when the color changed.
1166- if ( formatter. present ( in: typingAttributes) ) {
1166+ if formatter. present ( in: typingAttributes) {
11671167 typingAttributes = formatter. remove ( from: typingAttributes)
11681168 let applicationRange = formatter. applicationRange ( for: selectedRange, in: storage)
11691169 formatter. removeAttributes ( from: storage, at: applicationRange)
1170- typingAttributes = formatter. remove ( from: typingAttributes)
1171-
1170+ typingAttributes = formatter. remove ( from: typingAttributes)
1171+
11721172 // Reflect color changes by enabling the formatting again.
1173- if ( !resetColor) {
1173+ if !resetColor {
11741174 toggle ( formatter: formatter, atRange: range)
11751175 }
11761176 return
You can’t perform that action at this time.
0 commit comments