It's a text file which I only need to read.
Post
Replies
Boosts
Views
Activity
Thank you for your reply. Here's what my preview looks like. It's right above the expansion of the #Preview macro. I just added the return keyword right before HistoryView(words: $randomWords), but the problem persists.
#Preview {
let randomWord1 = FetchWord.getRandomWord()
let randomWord2 = FetchWord.getRandomWord()
@State var randomWords = [Word(word: randomWord1.0, IPA: randomWord1.1, lineNumber: randomWord1.2), Word(word: randomWord2.0, IPA: randomWord2.1, lineNumber: randomWord2.2)]
return HistoryView(words: $randomWords)
}
What do you mean by "@State inline"? Does that mean I can't declare a ``@State` variable in my preview? Sorry, I am new to app development.
I figured it out by myself. Thank you for trying to help though!