mobile apps banner

RichEditorSwiftUI

Swift Platforms CocoaPods Compatible Swift Package Manager

RichEditorSwiftUI (1)

功能

编辑器提供以下选项

RichEditorSwiftUI 的未来展望?🚀

我们对 RichEditorSwiftUI! 的未来感到兴奋!🎉 查看目前正在开发中的令人兴奋的功能

感谢您的支持和反馈 - 这推动了我们的旅程。 请继续关注这些增强功能以及更多!🙌

截图

编辑器浅色 编辑器深色
工具栏深色 工具栏浅色
mac 编辑器浅色
mac 编辑器深色

mac 编辑器视频

editor_video_sample_light_dark_mac.mov

iPhone 编辑器视频

editor_video_sample_light_dark_iphone.mp4

安装

Swift Package Manager

Swift Package Manager 是一种用于自动化 Swift 代码分发的工具,并已集成到 swift 编译器中。

设置好 Swift 包后,将 RichEditorSwiftUI 添加为依赖项就像将其添加到 Package.swiftdependencies 值中一样简单。

dependencies: [
    .package(url: "https://github.com/canopas/rich-editor-swiftui.git", .upToNextMajor(from: "1.1.0"))
]

CocoaPods

CocoaPods 是 Cocoa 项目的依赖管理器。 有关使用方法和安装说明,请访问其网站。 要使用 CocoaPods 将 RichEditorSwiftUI 集成到您的 Xcode 项目中,请在您的 Podfile 中指定它

target 'YourAppName' do
    pod 'RichEditorSwiftUI', '~> 1.1.1'
end

如何在您的项目中添加

添加依赖项

 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
        }
    }
}

演示

示例应用程序演示了该库的用法实际上是多么简单。

技术栈

RichEditorSwiftUI 利用最新的 Apple 技术并遵守行业最佳实践。 以下是开发过程中使用的当前技术堆栈

贡献

Canopas 团队热烈欢迎贡献和项目参与! 如果您想贡献力量,可以做很多事情! 贡献者指南 包含了您需要的所有信息,从报告错误到贡献全新的功能。 如果您愿意,请随时加入,如果有什么不清楚的地方,甚至可以问我们问题。

错误和反馈

对于错误、问题和讨论,请使用 Github Issues

鸣谢

SwiftUI 的 RichEditor 由 Canopas 团队 拥有和维护。 要获得项目更新和发布,您可以在 X 上关注他们:@canopassoftware

Android 的 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

   https://apache.ac.cn/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.