Post

Replies

Boosts

Views

Activity

Comment on Problems Updating a View
That (kinda) Worked! The content view now updates whenever the reader tells it to, though I still have problems with deleting or moving items in the array from content view. Whenever I delete something from the array it just refuses to do it, and whenever I try to move something, the whole app crashes, giving me this error: (Fatal error: Array index is out of range). Any thoughts on what to do here?
Jan ’22
Comment on Problems updating a variable
import CoreNFC struct ContentView: View {     @State var reader: NFCReader = NFCReader()     @State var tagCode = "UID"     var body: some View {         VStack{             Text(tagCode)             Button {                 reader.activate()                 tagCode = reader.tagUID             } label: {                 Text("Scan")                     .font(.title)             }.padding()              }     } }
Jan ’22
Comment on Problems updating a variable
Got it. The problem I am running into now is that when I make a @State variable in the view, when I press a button it is supposed to run the NFC program with ()activate and then update the variable tagCode to be equal to reader.tagUID, but it assigns the value before the reader gives tagUID a new UID. is there a way to update the variable only after the NFC program is done running?
Jan ’22