danielsaidi / RichTextKit

RichTextKit is a Swift SDK that helps you use rich text in Swift and SwiftUI.
MIT License
949 stars 126 forks source link

[FEATURE] Use environment keys for RichTextKeyboardToolbar styles and configuration #148

Closed r-jarvis closed 8 months ago

r-jarvis commented 9 months ago

This PR is in response to comments on this PR after merge: https://github.com/danielsaidi/RichTextKit/pull/140

I split out configuration and style into separate files and implemented the usage of EnvironmentKeys/EnvironmentValues in order to not require us to inject config/styles in the RichTextKeyboardToolbar initializer.

I did not make the RichTextKeyboardToolbarStyle and RichTextKeyboardToolbarStyleKey children of RichTextKeyboardToolbar because of issues with generics. The EnvironmentKey protocol requires concrete types and not generics. Since the generic types aren't actually used in the configuration and style this shouldn't cause any issues. There may be a way around this? Let me know if you'd like me to look into that deeper.

Added a few commented out lines to the iOS demo app in order to show usage. I'm not sure if that is the preferred method or not.

r-jarvis commented 9 months ago

@danielsaidi It looks like the same test that is failing here is also failing on main. Will update PR when that is fixed.

DominikBucher12 commented 9 months ago

Test fixed here: https://github.com/danielsaidi/RichTextKit/pull/146/files#r1495656071

danielsaidi commented 9 months ago

Hey @r-jarvis - that's great! I will take a look at this on Monday 👍

danielsaidi commented 8 months ago

Thank you for the PR @r-jarvis - I've merged it and will modify it a bit before 1.0 🎉