You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library was overkill for rich text, I guess because of linked entries. I believe linked entries should be made into a separate library and the rich text to NSAttributedString conversion should be made available in the core Contentful Swift SDK.
We ended up trying something like this without this library:
extensionArraywhere Element ==Node{
/// Converts the rich text type to plain string.
func string()->String{reduce(into:""){ result, next in
switch next {caseletobject as Text:
result += object.value
caseletobject as Paragraph:
result += object.content.string()default:
break
}}}}
This can be used like the following when you have a rich text property: object.body.content.string()
Apologies for asking this here but I couldn't find any other information online... is there contentful sanctioned swift equivalent for the npm plain-text-render here? https://www.npmjs.com/package/@contentful/rich-text-plain-text-renderer
Thank you
The text was updated successfully, but these errors were encountered: