1 year ago
#341720
Nguuyen Tien Quang
Can i append data direct to an array already stored in UserDefaults key
I have myArray with 80k member Int64.
myArray stored by key "datakey" in UserDefaults.
Can i append data direct to key: "datakey" for save time when i write into UserDefaults.
Normanly i can do this by some steps:
Read array from UserDefaults "datakey"
readArray = UserDefaults.standard.array(forKey: "datakey") as! [Int64]
append new member to readArray:
readArray.append(newNumber)
Re-write data to "datakey":
UserDefaults.standard.set(readArray, forKey: "datakey")
but as i said the array have more than 80k member, it take so long to complete write to UserDefaults
==>>Can i append data direct to key: "datakey" for save time when i write into UserDefaults.
arrays
swift
append
store
userdefaults
0 Answers
Your Answer