I've created a data-model in SwiftUI
import Foundation
struct BLSectionModel : Identifiable {
var descriptionTop : String
}
The data looks as follows:
import Foundation
import SwiftUI
let blSectionsDataV1 : [BLSectionModel] = [
bulletDescription: "I want to have multiple \(Text("**formats**")) for text in the _same **text box**_ at the same time even if it is really \(Text("_really_ **really _really_** ~~really~~")) long text so it would need to wrap correctly and maybe even include \(Text("[links](https://www.apple.com)!)")) to another website")
]
the code runs without an (obvious) error but all I see is
all I get on the view is I want to have multiple Text(storage: SwiftUI.Text.Storage.anyTextStorage(: "formats"), modifiers: [1) for text in the _same text box at the same time even if it is really Text(storage: SwiftUI.Text.Storage.anyTextStorage(<Lo calized TextStorage: 0x000060000156cf50>: "really really really really"), modifiers: []) long text so it would need to wrap correctly and maybe even include Text(storage: SwiftUI.Text.Storage.anyTextStorage(: "links!)"), modifiers: []) to another website
But I want to have
I want to have multiple for text in the same text box at the same time even if it is really (Text("really really really
<s>really<s>
")) long text so it would need to wrap correctly and maybe even include (Text("links!)")) to another website")
Unfortunately, your code doesn't compile, nor do you show how you are actually displaying the data. But I think I get the general idea. The key to getting it to display the text with the formatting is to convert it to
LocalizedStringKey(see How to format Text bold from a String in SwiftUI? for more explanation).Here is a working example based on your snippets: