Long story short, I made a few assumptions that didn't hold true when I started developing the macOS version. Designing for the unknown is often a vain task, but in this case, I just designed it in a way that I thought would made sense for both UIKit and AppKit. When building a multi-platform rich text engine that also should support SwiftUI, I was careful to design the foundation as platform-agnostic as possible. Many thanks to Oribi for this! Designing for multi-platform The result will be an open-source library that you’ll be able to use in your own projects. We also need some way of letting SwiftUI affect the platform-specific views, and for the platform-specific views and their delegates to affect SwiftUI correctly.Īll in all, this is a pretty complicated task, which is why I'm happy to announce that my client Oribi has given me permission to open-source a multi-platform rich text engine that I created for them as part of building a new version of their text editor Oribi Writer. differently.Īnother complication is SwiftUI, where we have to find a way to embed and bridge the platform-specific views in a way that works on all platforms. Adding multi-platform support to the mix makes things even worse, since UIKit and AppKit handle strings, attributes, attachments etc. Many basic tasks are actually pretty complicated. Well, you could think that it'd be that easy, but unfortunately it's not. as well as images and other kind of rich content with very little extra work. The text view will automatically support different fonts, styles, alignments etc. Just create a UITextView in UIKit (iOS and tvOS) and an NSTextView in AppKit (macOS) and use NSAttributedString, and you're good to go.
0 Comments
Leave a Reply. |