44# RichEditorSwiftUI
55[ ![ 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 )
66[ ![ 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 )
88[ ![ 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 )
99
1010![ RichEditorSwiftUI (1)] ( https://github.com/canopas/rich-editor-swiftui/assets/73588408/8c3013ae-8a27-4ebc-a511-51e726825c4b )
1111
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-
1612## Features
1713
1814The editor offers the following <b >options</b >:
@@ -29,6 +25,59 @@ The editor offers the following <b>options</b>:
2925- [x] Background color
3026- [x] Export with .txt, .rtf, .pdf, .json
3127
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+
3281## Installation
3382
3483### Swift Package Manager
@@ -66,10 +115,36 @@ Add the dependency
66115```
67116struct EditorView: View {
68117 @ObservedObject var state: RichEditorState = .init(input: "Hello World")
69-
118+
70119 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+ }
73148 }
74149}
75150```
0 commit comments