@@ -9,15 +9,15 @@ class LayoutManager: NSLayoutManager {
99
1010 /// Blockquote's Left Border Color
1111 ///
12- var blockquoteBorderColor = UIColor ( red: 0.52 , green: 0.65 , blue: 0.73 , alpha: 1.0 )
12+ var blockquoteBorderColor : UIColor ? = UIColor ( red: 0.52 , green: 0.65 , blue: 0.73 , alpha: 1.0 )
1313
1414 /// Blockquote's Background Color
1515 ///
16- var blockquoteBackgroundColor = UIColor ( red: 0.91 , green: 0.94 , blue: 0.95 , alpha: 1.0 )
16+ var blockquoteBackgroundColor : UIColor ? = UIColor ( red: 0.91 , green: 0.94 , blue: 0.95 , alpha: 1.0 )
1717
1818 /// HTML Pre Background Color
1919 ///
20- var preBackgroundColor = UIColor ( red: 243.0 / 255.0 , green: 246.0 / 255.0 , blue: 248.0 / 255.0 , alpha: 1.0 )
20+ var preBackgroundColor : UIColor ? = UIColor ( red: 243.0 / 255.0 , green: 246.0 / 255.0 , blue: 248.0 / 255.0 , alpha: 1.0 )
2121
2222 /// Closure that is expected to return the TypingAttributes associated to the Extra Line Fragment
2323 ///
@@ -126,12 +126,17 @@ private extension LayoutManager {
126126 /// Draws a single Blockquote Line Fragment, in the specified Rectangle, using a given Graphics Context.
127127 ///
128128 private func drawBlockquote( in rect: CGRect , with context: CGContext ) {
129- blockquoteBackgroundColor. setFill ( )
130- context. fill ( rect)
129+ if let blockquoteBackgroundColor = blockquoteBackgroundColor {
130+ blockquoteBackgroundColor. setFill ( )
131+ context. fill ( rect)
132+
133+ }
131134
132- let borderRect = CGRect ( origin: rect. origin, size: CGSize ( width: blockquoteBorderWidth, height: rect. height) )
133- blockquoteBorderColor. setFill ( )
134- context. fill ( borderRect)
135+ if let blockquoteBorderColor = blockquoteBorderColor {
136+ let borderRect = CGRect ( origin: rect. origin, size: CGSize ( width: blockquoteBorderWidth, height: rect. height) )
137+ blockquoteBorderColor. setFill ( )
138+ context. fill ( borderRect)
139+ }
135140 }
136141}
137142
@@ -172,6 +177,9 @@ private extension LayoutManager {
172177 /// Draws a single HTML Pre Line Fragment, in the specified Rectangle, using a given Graphics Context.
173178 ///
174179 private func drawHTMLPre( in rect: CGRect , with context: CGContext ) {
180+ guard let preBackgroundColor = preBackgroundColor else {
181+ return
182+ }
175183 preBackgroundColor. setFill ( )
176184 context. fill ( rect)
177185 }
0 commit comments