Hello, thanks for the feedback, I appreciate it!
This is a great question. You see, `TextContext` is the main entity to interact with the editor content on the frontend and `TextCoordinator` on the backend. And when you want to extend the customisation capabilities, you simply add a new observable to `TextContext` and a configuration method to `TextCoordinator`.
The implementation presented in this article assumes that styles are applied to a user-selected range of text that is present in the editor. But you can change this and pass the desired range as a parameter to the method you intend to add.
For example, in `TextCoordinator` you can add `updateBold(with value: Bool, in range: NSRange)` in addition to `updateBold(with value: Bool)`, which will allow you to apply the style to any range you want, not just the one the user has selected.
And in TextContext you will have not just `isBold: Bool`, but `isBold: (Bool, NSRange)`, where `NSRange` will specify the range of style application.
But this is just a brief example of where the solution could go. I would in any case think about avoiding any mention of `NSRange` within the `View` layer, encapsulate this at the `TextContext` level and expose a simple `Range` type (or come up with something else, its up to developer). Same about the `NSAttributedString` instance that is created here in `View` - it should be incapsulated in `TextContext` as well and some simple properties like `string` should be accessible.