TextView func storage(_ storage: TextStorage, placeholderFor attachment: NSTextAttachment) -> UIImage is crashing my app in production of the following guard statement contains a fatalError.
guard let textAttachmentDelegate = textAttachmentDelegate else {
fatalError("This class requires a text attachment delegate to be set.")
}
return textAttachmentDelegate.textView(self, placeholderFor: attachment)
The problem with this is that earlier in the file the following is explicitly stated for the textAttachmentDelegate optional.
/// The media delegate takes care of providing remote media when requested by the `TextView`.
/// If this is not set, all remove images will be left blank.
///
open weak var textAttachmentDelegate: TextViewAttachmentDelegate?
Which would imply that the TextView will continue to function, only without displaying images. Not fatalError crashing.
This seems to be the case with all of the storage functions.
To Reproduce
Steps to reproduce the behavior:
Create an instance of the TextView without instantiating textAttachmentDelegate
Render the Field in a SwiftUI view.
Expected behavior
A clear and concise description of what you expected to happen.
A TextView should continue to run rendering the HTML and images remain blank, WITHOUT crashing the app, as implied by the documentation. (Unless there is actually something called 'remove images'.)
Screenshots
If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
Device: iPhone 15 Pro
OS: 17.5.1
Additional context
Add any other context about the problem here.
Describe the bug
TextView
func storage(_ storage: TextStorage, placeholderFor attachment: NSTextAttachment) -> UIImage
is crashing my app in production of the following guard statement contains a fatalError.The problem with this is that earlier in the file the following is explicitly stated for the textAttachmentDelegate optional.
Which would imply that the TextView will continue to function, only without displaying images. Not fatalError crashing.
This seems to be the case with all of the storage functions.
To Reproduce Steps to reproduce the behavior:
Create an instance of the TextView without instantiating textAttachmentDelegate
Expected behavior A clear and concise description of what you expected to happen.
A TextView should continue to run rendering the HTML and images remain blank, WITHOUT crashing the app, as implied by the documentation. (Unless there is actually something called 'remove images'.)
Screenshots If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.