Skip to content

Update readme #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 104 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,81 @@
<img width="930" alt="mobile apps banner" src="https://github.com/canopas/rich-editor-swiftui/assets/73588408/84c94bbd-7952-45cb-9bfb-95e0687b37b0">

# RichEditorSwiftUI
[![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)
[![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)
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/RichEditorSwiftUI.svg?style=flat-square)](https://img.shields.io/cocoapods/v/RichEditorSwiftUI.svg)
[![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)

![RichEditorSwiftUI (1)](https://github.com/canopas/rich-editor-swiftui/assets/73588408/8c3013ae-8a27-4ebc-a511-51e726825c4b)

## A swift-based library to make rich text editing very easy with SwiftUI.

<img src="./docs/sample.gif" height="640" /> <img src="./docs/dark_mode_sample.gif" height="640" />

## Features

The editor offers the following <b>options</b>:

- [x] **Bold**
- [x] *Italic*
- [x] <u>Underline</u>
- [x] ~~Strikethrough~~
- [x] Different Heading
- [x] Text Alignment
- [x] Font size
- [x] Font color
- [x] Font family
- [x] Background color
- [x] Export with .txt, .rtf, .pdf, .json

## Screenshots

<table>
<tr>
<th width="33%" >Editor light</th>
<th width="33%" >Editor dark</th>
</tr>
<tr>
<td><img src="docs/editor_iphone_light.png" /></td>
<td> <img src="docs/editor_iphone_dark.png" /> </td>
</tr>
</table>

<table>
<tr>
<th width="33%" >Toolbar dark</th>
<th width="33%" >Toolbar light</th>
</tr>
<tr align="center">
<td><img src="docs/editor_toolbar_iphone_dark.png" /></td>
<td> <img src="docs/editor_toolbar_iphone_light.png" /> </td>
</tr>
</table>

<table>
<tr>
<th width="100%" >mac Editor light</th>
</tr>
<tr align="center">
<td><img src="docs/editor_mac_light.png" width="70%" /></td>
</tr>
</table>

<table>
<tr>
<th width="100%" >mac Editor dark</th>
</tr>
<tr align="center">
<td> <img src="docs/editor_mac_dark.png" width="70%" /> </td>
</tr>
</table>

## mac Editor video

<div align="center">
<video src="https://github.com/user-attachments/assets/844d8843-41e9-44c2-8a0c-afedaa55c5cb" />
</div>

## Editor video
<div align="center">
<video src="https://github.com/user-attachments/assets/f99804fb-8612-4e46-b172-66567d1acf91" />
</div>

## Installation

Expand Down Expand Up @@ -55,19 +115,56 @@ Add the dependency
```
struct EditorView: View {
@ObservedObject var state: RichEditorState = .init(input: "Hello World")

var body: some View {
RichEditor(state: _state)
.padding(10)
VStack {
#if os(macOS)
RichTextFormat.Toolbar(context: state)
#endif

RichTextEditor(
context: _state,
viewConfiguration: { _ in

}
)
.cornerRadius(10)

#if os(iOS)
RichTextKeyboardToolbar(
context: state,
leadingButtons: { $0 },
trailingButtons: { $0 },
formatSheet: { $0 }
)
#endif
}
.inspector(isPresented: $isInspectorPresented) {
RichTextFormat.Sidebar(context: state)
#if os(macOS)
.inspectorColumnWidth(min: 200, ideal: 200, max: 320)
#endif
}
}
}
```
# Demo
[Sample](https://github.com/canopas/rich-editor-swiftui/tree/main/RichEditorDemo) app demonstrates how simple the usage of the library actually is.

## Tech stack

RichEditorSwiftUI utilizes the latest Apple technologies and adheres to industry best practices. Below is the current tech stack used in the development process:

- MVVM Architecture
- SwiftUI
- Swift
- Xcode

# Bugs and Feedback
For bugs, questions, and discussions please use the [Github Issues](https://github.com/canopas/rich-editor-swiftui/issues).

## Contribution
Currently, we are not accepting any contributions.

## Credits
RichEditor for SwiftUI is owned and maintained by the [Canopas team](https://canopas.com/). For project updates and releases, you can follow them on X at [@canopas_eng](https://x.com/canopas_eng).
Expand Down
151 changes: 103 additions & 48 deletions RichEditorDemo/RichEditorDemo/Sample_json.json
Original file line number Diff line number Diff line change
@@ -1,122 +1,177 @@
{
"spans": [
{
"insert": "RichEditor",
"insert": "RichEditorSwiftUI",
"attributes": {
"bold": true,
"header": 1
"color": "#FF9500",
"size": 24,
"font": "Academy Engraved LET"
}
},
{
"insert": "\niOS ",
"attributes": {}
"attributes": {},
"insert": "\n\nIt’s Support "
},
{
"insert": "RichEditorSwiftUI ",
"insert": "bold",
"attributes": {
"bold": true,
"italic": true
"bold": true
}
},
{
"insert": "Rich editor for ",
"attributes": {}
"attributes": {},
"insert": ", "
},
{
"attributes": {
"italic": true
},
"insert": "italic"
},
{
"attributes": {},
"insert": ", "
},
{
"insert": "SwiftUI.\n\n",
"attributes": {
"bold": true,
"underline": true
}
},
"insert": "underline"
},
{
"insert": "Features",
"attributes": {},
"insert": " and "
},
{
"insert": "striketrhough",
"attributes": {
"bold": true,
"header": 3
"strike": true
}
},
{
"insert": "\nThe editor offers the following ",
"attributes": {}
"attributes": {},
"insert": " formats.\n\nWe have different headings\n"
},
{
"insert": "options:\n",
"insert": "Heading 1\n",
"attributes": {
"bold": true,
"italic": true,
"underline": true
"header": 1
}
},
{
"insert": "\n",
"attributes": {}
"insert": "Heading 2",
"attributes": {
"header": 2
}
},
{
"attributes": {},
"insert": "\n"
},
{
"insert": "Bold\n",
"insert": "Heading 3\n",
"attributes": {
"bold": true
"header": 3
}
},
{
"insert": "Italic\n",
"insert": "Heading 4\n",
"attributes": {
"italic": true
"header": 4
}
},
{
"insert": "Underline\n",
"insert": "Heading 5\n",
"attributes": {
"underline": true
"header": 5
}
},
{
"insert": "Heading 6\n",
"attributes": {
"header": 6
}
},
{
"insert": "Different ",
"insert": "\nHere we have ",
"attributes": {}
},
{
"insert": "Headings\n\n",
"attributes": {
"bold": true,
"italic": true,
"underline": true
"size": 24
},
"insert": "large"
},
{
"attributes": {},
"insert": " and "
},
{
"attributes": {
"size": 10
},
"insert": "small"
},
{
"attributes": {},
"insert": " text and "
},
{
"insert": "custom fonts",
"attributes": {
"font": "ChalkboardSE-Light",
"color": "#007AFF"
}
},
{
"insert": "\n",
"insert": " as well.\n\nYou can align text differently\nHere is the left align\n",
"attributes": {}
},
{
"insert": "Credits",
"attributes": {
"bold": true,
"header": 3
"align": "center"
},
"insert": "This is center align\n"
},
{
"insert": "This is right align\n",
"attributes": {
"align": "right"
}
},
{
"insert": "\n\n",
"attributes": {},
"insert": "\nDifferent font "
},
{
"insert": "color",
"attributes": {
"color": "#34C759"
}
},
{
"insert": " and ",
"attributes": {}
},
{
"insert": "RichEditor ",
"insert": "background",
"attributes": {
"bold": true
"background": "#32ADE6"
}
},
{
"insert": "for SwiftUI is developed and maintained by the ",
"insert": "\n\nThank You! Team ",
"attributes": {}
},
{
"insert": "Canopas Team.",
"attributes": {
"bold": true,
"italic": true,
"underline": true
}
"color": "#F67C8E"
},
"insert": "Canopas"
},
{
"insert": "\n\nThank You! 😊\n\n",
"insert": " 😊",
"attributes": {}
}
]
Expand Down
2 changes: 1 addition & 1 deletion RichEditorSwiftUI.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|

s.module_name = 'RichEditorSwiftUI'
s.requires_arc = true
s.swift_version = '5.5'
s.swift_version = '5.9'

s.preserve_paths = 'README.md'

Expand Down
Binary file removed docs/dark_mode_sample.gif
Binary file not shown.
Binary file added docs/editor_iphone_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/editor_iphone_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/editor_mac_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/editor_mac_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/editor_toolbar_iphone_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/editor_toolbar_iphone_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/sample.gif
Binary file not shown.