Here are the code I used and tried.
struct Cal: Codable {
var calendar: [String: BlockCal ]
}
struct BlockCal: Codable {
var filler: String
var items: GroceryItemArray
var itemsRefs: ReferenceArray
var chores: GroceryItemArray
}
struct GroceryItemArray: Codable {
var filler: String
var keyValueArray: [String: GroceryItem]
}
struct ReferenceArray: Codable {
var filler: String
var keyValueArray: [String: String]
}
final class PersistencyManagerReal {
private var cal: Cal!
//...
func setCalendar(cal: Cal) {
self.cal = cal
}
}
//...
Database.database().reference().child("users")....observe(.value, with: { [weak self] snapshot in
guard let self = self else { return }
guard let snapshotValue = snapshot.value else { return }
do {
let groups: Cal = try FirebaseDecoder().decode(Cal.self, from: snapshotValue)
someClass.setCalendar(cal: groups). //save decoded !
} catch {
//...
}
}
Question:
If the decoded snapshot is save into a property named ‘cal’, is that a bad practice that Apple Store will reject (because that approach might use a huge amount of memory) ?
The above are a sample of the code I used. The code works well in the app. If Apple Store will likely reject the above approach, what is the approach that Apple Store review will accept and my app can get approval ?
Must use either CoreData, SwiftData, Realm, or … ?
Any help / info will be much appreciated ! Thank you very much.
Yee468 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.