Skip to content

Commit 8cc4a2f

Browse files
committed
Updated the basic code example
1 parent 71c2b7f commit 8cc4a2f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@ Basic code to make it work:
1717

1818
// setup the system
1919
let textStorage = ParagraphTextStorage()
20+
textStorage.paragraphDelegate = self
21+
2022
let layoutManager = NSLayoutManager()
2123
textStorage.addLayoutManager(layoutManager)
24+
25+
let textContainer = NSTextContainer(containerSize: .zero)
26+
layoutManager.addTextContainer(textContainer)
27+
28+
let textView = NSTextView(frame: someFrame, textContainer: textContainer)
29+
someScrollView.documentView = textView
30+
2231

2332
If you need to sync your model with ParagraphTextStorage content, set the paragraphDelegate to adopt the ParagraphTextStorageDelegate protocol.
2433
It's just two methods:

0 commit comments

Comments
 (0)