I would like to show paragraphs of text in a ForEach. This was my latest attempt: struct ContentView: View { let bodyText = This is a sample body text that will wrap naturally within the bounds of the container. var body: some View { WordWrapView(words: identifyWords(words: bodyText)) .padding() } func identifyWords(words: String) -> [IdentifiedWord] { let wordsArray = words.split(separator: ).map { String($0) } var idCounter = 1 return wordsArray.reversed().map { word in let identifiedWord = IdentifiedWord(id: String(idCounter), word: word) idCounter += 1 return identifiedWord } } } struct IdentifiedWord: Identifiable { let id: String let word: String } struct WordWrapView: View { let words: [IdentifiedWord] var body: some View { GeometryReader { geometry in self.createWrappedWords(in: geometry.size) } } func createWrappedWords(in size: CGSize) -> some View { var width: CGFloat = 0 var height: CGFloat = 0 return ZStack(alignment: .topLeading) { ForEach(words) { word in self.wordView(for: word
Topic:
UI Frameworks
SubTopic:
SwiftUI