Coder Social home page Coder Social logo

richtextkit's Introduction

RichTextKit Logo

Version Swift 5.8 MIT License Twitter: @danielsaidi Mastodon: @danielsaidi@mastodon.social

About RichTextKit

RichTextKit helps you view and edit rich text in SwiftUI, UIKit and AppKit.

RichTextKit has a multi-platform SwiftUI RichTextEditor that can be added to any app:

The RichTextEditor supports text styles (bold, italic, underline, etc.), fonts and font sizes, colors, text alignments, image attachments, etc.

The RichTextEditor is powered by a UIKit/AppKit RichTextView that bridges the UIKit UITextView and AppKit NSTextView and adds APIs to make the view work similar on both platforms.

Installation

RichTextKit can be installed with the Swift Package Manager:

https://github.com/danielsaidi/RichTextKit.git

If you prefer to not have external dependencies, you can also just copy the source code into your app.

Getting started

RichTextKit has a SwiftUI RichTextEditor that takes a text binding and a RichTextContext:

struct MyView: View {

    @State
    private var text = NSAttributedString(string: "Type here...")
    
    @StateObject
    var context = RichTextContext()

    var body: some View {
        RichTextEditor(text: $text, context: context) {
            // You can customize the native text view here
        }
    }
}

The editor uses a RichTextCoordinator to sync changes between the editor, context, and platform-specific view. You can use the context to change font, colors, alignment etc. and observe context changes to update the UI.

For more information, please see the getting started guide.

Documentation

The online documentation has more information, articles, code examples, etc.

Demo Application

The demo app lets you explore the library on iOS and macOS. To try it out, just open and run the Demo project.

Support my work

You can sponsor me on GitHub Sponsors or reach out for paid support, to help support my open-source projects.

Contact

Feel free to reach out if you have questions or want to contribute in any way:

License

RichTextKit is available under the MIT license. See the LICENSE file for more info.

richtextkit's People

Contributors

danielsaidi avatar dominikbucher12 avatar josephlevy222 avatar jamesbradleym avatar mcrich23 avatar msrutek-paylocity avatar jake-b avatar ropellanda avatar jdelano avatar itsliamdowd avatar mhasan341 avatar yaroslav2308 avatar dnzlk avatar willmorris44 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.