Create an Array in Swift from an NSData Object

后端 未结 4 1052
说谎
说谎 2020-12-13 09:13

I\'m trying to store an array of integers to disk in swift. I can get them into an NSData object to store, but getting them back out into an array is difficult. I can get

4条回答
  •  伪装坚强ぢ
    2020-12-13 09:50

    If you are dealing with Data to Array (I know for sure my array is going to be [String]), I am quite happy with this:

    NSKeyedUnarchiver.unarchiveObject(with: yourData)

    I hope it helps

提交回复
热议问题