Skip to content

Duplicate IDs in ForEach When Using RichTextEditor and Font Toolbar #237

Open
@IhorKram

Description

@IhorKram

I'm encountering multiple runtime warnings when initializing RichTextEditor:

ForEach<Array<RichTextAction>, String, Button>: the ID occurs multiple times within the collection, this will give undefined results!
ForEach<Array<RichTextAction>, String, ModifiedContent<Button, _FlexFrameLayout>>: the ID occurs multiple times within the collection, this will give undefined results!

These warnings appear during the initial setup of the editor.

Additionally, when the toolbar appears and the user taps to edit text style (e.g., to access fonts, colors, and styles), the following error occurs:

ForEach<Array<RichTextAction>, String, Button>: the ID occurs multiple times within the collection, this will give undefined results!

As a result, the navigation bar in the font/style tools view fails to render a Done button, making it unclear how to dismiss the view.

Notes:
The code is directly copy-pasted from the demo app, with no modifications.

The library is integrated via Swift Package Manager.

Please let me know if you'd like a minimal reproducible example or more environment details.

Thanks for your work on this great library!

Image

Image

And RichTextKeyboardToolbar has the same kind of problem...
Image

UPD:
The issue seems to be related to CocoaPods. If I run pod init and pod install (even with an empty Podfile and no pods added) and then open the project via .xcworkspace, the duplicate ID errors occur consistently.

However, after running pod deintegrate and opening the project through .xcodeproj, everything works fine and the warnings no longer appear.

It's worth noting that RichTextKit is still integrated via Swift Package Manager — CocoaPods is not being used to install the library. This suggests that the issue might be caused by an interaction between SwiftPM and the CocoaPods integration layer, even when no pods are installed.

UPD2:
Turns out it's not related to CocoaPods after all. The errors also appear in a project that doesn't use CocoaPods at all.

I then suspected localization might be the cause — and partially, it seems to be. Some projects without localization don't trigger the error, while others still do. So while localization may influence it, it's not the sole reason. The root cause still seems inconsistent and unclear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionDiscussions not yet turned into an action

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions