Hi there,
First off, I wanted to thank you for your fantastic work and dedication to this project and for being incredibly active! I couldn't have been happier to find RichEditorView as I have been looking for a more updated version of the original ZSSRichTextEditor for some time.
My problem:
I want to set the HTML of my REV on initialization so that it opens with the HTML already set (passed in from another VC).
My setup is as follows:
I have a VC that manages the entire parent view (with some additional UI/actions) and an embedded container view that has it's own VC whose responsibility is to manage the actual REV.
Parent VC (Obj-C):
@property (strong, nonatomic) LessonViewController *lessonViewController;
- (void)prepareForSegue { // embedSegue
...
self.lessonViewController = (LessonViewController *)segue.destinationViewController;
self.lessonViewController.lessonContents = self.lesson.contents; // where lesson is a data model
REV VC (Swift):
@objc public class LessonViewController: UIViewController {
@IBOutlet weak var editorView: RichEditorView!
public var lessonContents: String = "" {
didSet {
editorView.setHTML(lessonContents)
}
This causes an unexpectedly found nil while unwrapping an Optional value. Doing some debugging, it turns out that in the didSet, the editorView is nil at that moment. I'm not sure why that is (the outlet is properly hooked up in IB). I've also tried calling editorView.setHTML() in a separate method and not in the didSet { } but I run into the same issue.
Any insight would be greatly appreciated, and perhaps you have another way you'd recommend pre-setting the HTML of REV before it opens, with the HTML being passed in from a different VC.