You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-3Lines changed: 29 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,20 +38,28 @@ This package is fully documented [here](https://codeeditapp.github.io/CodeEditSo
38
38
39
39
## Usage (SwiftUI)
40
40
41
+
CodeEditSourceEditor provides two APIs for creating an editor: SwiftUI and AppKit. The SwiftUI API provides extremely customizable and flexible configuration options, including two-way bindings for state like cursor positions and scroll position.
42
+
43
+
For more complex features that require access to the underlying text view or text storage, we've developed the <doc:TextViewCoordinators> API. Using this API, developers can inject custom behavior into the editor as events happen, without having to work with state or bindings.
44
+
41
45
```swift
42
46
importCodeEditSourceEditor
43
47
44
48
structContentView: View {
45
49
@Statevar text ="let x = 1.0"
46
50
47
-
/// Automatically updates with cursor positions, or update the binding to set the user's cursors.
Copy file name to clipboardExpand all lines: Sources/CodeEditSourceEditor/Documentation.docc/SourceEditor.md
+29-5Lines changed: 29 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,9 @@
2
2
3
3
## Usage
4
4
5
-
CodeEditSourceEditor provides two APIs for creating an editor: SwiftUI and AppKit.
5
+
CodeEditSourceEditor provides two APIs for creating an editor: SwiftUI and AppKit. We provide a fast and efficient SwiftUI API that avoids unnecessary view updates whenever possible. It also provides extremely customizable and flexible configuration options, including two-way bindings for state like cursor positions and scroll position.
6
+
7
+
For more complex features that require access to the underlying text view or text storage, we've developed the <doc:TextViewCoordinators> API. Using this API, developers can inject custom behavior into the editor as events happen, without having to work with state or bindings.
6
8
7
9
#### SwiftUI
8
10
@@ -12,11 +14,12 @@ import CodeEditSourceEditor
12
14
structContentView: View {
13
15
14
16
@Statevar text ="let x = 1.0"
15
-
// For large documents use (avoids SwiftUI inneficiency)
17
+
// For large documents use a text storage object (avoids SwiftUI comparisons)
16
18
// var text: NSTextStorage
17
19
18
-
/// Automatically updates with cursor positions, or update the binding to set the user's cursors.
0 commit comments