Skip to content

Conversation

@thecoolwinter
Copy link
Collaborator

Description

Adds the ability to initialize the editor view using an NSTextStorage object, rather than a String binding. This allows users to use a more efficient method for storing text outside of the editor. It also means a developer who uses this API will avoid any extra string copying and can help avoid unnecessary view evaluations when using SwiftUI. That's because Bindings are compared to check if a new value was added when the value of the binding is set. Because a new value is set each keystroke, this results in the entire contents of the editor being compared character by character each keystroke.

This also adds a Text Coordinator called CombineCoordinator. This class passes on notifications to Combine streams and is a good example of a useful coordinator. This is necessary for the related issue. It could be implemented in CodeEdit but I felt it was useful as an example of a real-world coordinator and added documentation for it towards that purpose.

Additionally, I've updated the documentation for the package to reflect the current README as well as more information about coordinators.

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code
@thecoolwinter
Copy link
Collaborator Author

@CodeEditApp/maintainers can I get a review on this

@thecoolwinter thecoolwinter merged commit 1740482 into CodeEditApp:main May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants