I'm new to asking questions on these sorts of forums so apologies if this is an inappropriate place. I want to be respectful of the fact that this is just for Swift and not Firebase, but I think this is a Swift question:
I'm trying to access data from Firebase. The data is collected from FB and added to a list (which is just how the data has to be retrieved to my knowledge). Changing nothing about the 'call' function, sometimes the program runs and displays the information, and sometimes it doesn't. It seems to be an initialization issue: For the sake of this discussion I have five 'main' pages in my app and ten 'subordinate' pages which can be clicked into from the five main pages. When the FB data is inserted on one of the 'main' pages, the app crashes with an lldb error, because the list is not yet populated, however, copying the same code onto a 'subordinate' page (see below) it runs just fine. This leads me to assume that the main pages populate before the init functions are called, but before the subordinate pages are populated. How do I address this?
I tried putting the init function into Content View because that loaded before anything else
Sorry, again, if this is inappropriate to ask, I've been banging my head against the wall on this for the better part of two days. I think it's a Swift-side problem
struct TestDeck2: View {
@ObservedObject var genFs = GenFuncs()
init() {
genFs.UsrCoreInfoList()
}
var body: some View {
VStack{
Text("\(genFs.UsrCorInfL[0].FirstN)")
Button(action:{ print("Fill"); print("\(genFs.UsrCorInfL[0].IGCbal)") } ) //addFN(FN: FNo, H_1url: H_1url_out ) } )
{Image(systemName:"water.waves")}
}
}
}