4
4
# RichEditorSwiftUI
5
5
[ ![ Swift] ( https://img.shields.io/badge/Swift-5.9-orange?style=flat-square )] ( https://img.shields.io/badge/Swift-5.9-Orange?style=flat-square )
6
6
[ ![ Platforms] ( https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_visionOS-yellowgreen?style=flat-square )] ( https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_vision_OS_-Green?style=flat-square )
7
- [ ![ CocoaPods Compatible] ( https://img.shields.io/cocoapods/v/Alamofire .svg?style=flat-square )] ( https://img.shields.io/cocoapods/v/Alamofire .svg )
7
+ [ ![ CocoaPods Compatible] ( https://img.shields.io/cocoapods/v/RichEditorSwiftUI .svg?style=flat-square )] ( https://img.shields.io/cocoapods/v/RichEditorSwiftUI .svg )
8
8
[ ![ Swift Package Manager] ( https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square )] ( https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square )
9
9
10
10
![ RichEditorSwiftUI (1)] ( https://github.com/canopas/rich-editor-swiftui/assets/73588408/8c3013ae-8a27-4ebc-a511-51e726825c4b )
11
11
12
- ## A swift-based library to make rich text editing very easy with SwiftUI.
13
-
14
- <img src =" ./docs/sample.gif " height =" 640 " /> <img src =" ./docs/dark_mode_sample.gif " height =" 640 " />
15
-
16
12
## Features
17
13
18
14
The editor offers the following <b >options</b >:
@@ -29,6 +25,59 @@ The editor offers the following <b>options</b>:
29
25
- [x] Background color
30
26
- [x] Export with .txt, .rtf, .pdf, .json
31
27
28
+ ## Screenshots
29
+
30
+ <table >
31
+ <tr >
32
+ <th width="33%" >Editor light</th>
33
+ <th width="33%" >Editor dark</th>
34
+ </tr >
35
+ <tr >
36
+ <td><img src="docs/editor_iphone_light.png" /></td>
37
+ <td> <img src="docs/editor_iphone_dark.png" /> </td>
38
+ </tr >
39
+ </table >
40
+
41
+ <table >
42
+ <tr >
43
+ <th width="33%" >Toolbar dark</th>
44
+ <th width="33%" >Toolbar light</th>
45
+ </tr >
46
+ <tr align =" center " >
47
+ <td><img src="docs/editor_toolbar_iphone_dark.png" /></td>
48
+ <td> <img src="docs/editor_toolbar_iphone_light.png" /> </td>
49
+ </tr >
50
+ </table >
51
+
52
+ <table >
53
+ <tr >
54
+ <th width="100%" >mac Editor light</th>
55
+ </tr >
56
+ <tr align =" center " >
57
+ <td><img src="docs/editor_mac_light.png" width="70%" /></td>
58
+ </tr >
59
+ </table >
60
+
61
+ <table >
62
+ <tr >
63
+ <th width="100%" >mac Editor dark</th>
64
+ </tr >
65
+ <tr align =" center " >
66
+ <td> <img src="docs/editor_mac_dark.png" width="70%" /> </td>
67
+ </tr >
68
+ </table >
69
+
70
+ ## mac Editor video
71
+
72
+ <div align =" center " >
73
+ <video src =" https://github.com/user-attachments/assets/844d8843-41e9-44c2-8a0c-afedaa55c5cb " />
74
+ </div >
75
+
76
+ ## Editor video
77
+ <div align =" center " >
78
+ <video src =" https://github.com/user-attachments/assets/f99804fb-8612-4e46-b172-66567d1acf91 " />
79
+ </div >
80
+
32
81
## Installation
33
82
34
83
### Swift Package Manager
@@ -66,10 +115,36 @@ Add the dependency
66
115
```
67
116
struct EditorView: View {
68
117
@ObservedObject var state: RichEditorState = .init(input: "Hello World")
69
-
118
+
70
119
var body: some View {
71
- RichEditor(state: _state)
72
- .padding(10)
120
+ VStack {
121
+ #if os(macOS)
122
+ RichTextFormat.Toolbar(context: state)
123
+ #endif
124
+
125
+ RichTextEditor(
126
+ context: _state,
127
+ viewConfiguration: { _ in
128
+
129
+ }
130
+ )
131
+ .cornerRadius(10)
132
+
133
+ #if os(iOS)
134
+ RichTextKeyboardToolbar(
135
+ context: state,
136
+ leadingButtons: { $0 },
137
+ trailingButtons: { $0 },
138
+ formatSheet: { $0 }
139
+ )
140
+ #endif
141
+ }
142
+ .inspector(isPresented: $isInspectorPresented) {
143
+ RichTextFormat.Sidebar(context: state)
144
+ #if os(macOS)
145
+ .inspectorColumnWidth(min: 200, ideal: 200, max: 315)
146
+ #endif
147
+ }
73
148
}
74
149
}
75
150
```
0 commit comments