The editor offers the following options:
- Bold
- Italic
- Underline
-
Strikethrough - Different Heading
- Text Alignment
- Font size
- Font color
- Font family
- Background color
- Export with .txt, .rtf, .pdf, .json
Editor light | Editor dark |
---|---|
Toolbar dark | Toolbar light |
---|---|
mac Editor light |
---|
mac Editor dark |
---|
editor_video_sample_light_dark_mac.mov
editor_video_sample_light_dark_iphone.mp4
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler.
Once you have your Swift package set up, adding RichEditorSwiftUI as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/canopas/rich-editor-swiftui.git", .upToNextMajor(from: "1.1.0"))
]
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate RichEditorSwiftUI into your Xcode project using CocoaPods, specify it in your Podfile:
target 'YourAppName' do
pod 'RichEditorSwiftUI', '~> 1.1.0'
end
Add the dependency
import RichEditorSwiftUI
struct EditorView: View {
@ObservedObject var state: RichEditorState = .init(input: "Hello World")
var body: some View {
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
}
}
}
Sample app demonstrates how simple the usage of the library actually is.
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
For bugs, questions, and discussions please use the Github Issues.
Currently, we are not accepting any contributions.
RichEditor for SwiftUI is owned and maintained by the Canopas team. For project updates and releases, you can follow them on X at @canopas_eng.
A similar library is also available for Android in Jetpack Compose here.
RichTextKit: https://github.com/danielsaidi/RichTextKit
Copyright 2023 Canopas Software LLP
Licensed under the Apache License, Version 2.0 (the "License");
You won't be using this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.