HJH IT Logs
collections removeall()
naver.how
2019. 1. 14. 10:14
반응형
arrays, dictionaries, sets 같은 컬렉션은 removeall 할 때 다 지워진다. 정말루... 지우고 새로 생성해 줘야 한다.
jhDataCenter.nonNetworkData.removeAll()
하고 데이터 넣지맛!
_ = json["data"]["glucose"]["cgm"].arrayValue.map({
.
.
.
jhDataCenter.mDatas.removeAll(keepingCapacity: true)
얘도 마찬가지... 걍 지우고 다시 만들어 주는 clean 함수를 만드는게 낫다.
public static func clean() {
jhDataCenter.mDatas.removeAll()
jhDataCenter.mDatas = [0:hjh(d: Array<sss>()), //CGM
1:hjh(d: Array<sssss>()), //bolus
2:hjh(d: Array<sssss>()), //Basal
3:hjh(d: Array<sss>()) //BG
]
}
반응형