직접 만든 DTO를 UserDefaults에 저장 시킬 때 발생하는 오류

 

안드로이드로 비유하자면 implements Serializable같은 과정이 필요함

let encode = JSONEncoder()
let data = try? encode.encode(만든DTO)

 

이 data를 저장하면 오류 해결!

 

참조 : youjean.tistory.com/34

'IOS > SwiftUI' 카테고리의 다른 글

(SwiftUI)16.lazyGridView  (0) 2021.04.29
(SwiftUI)15.피커뷰  (0) 2021.04.28
(SwiftUI)14.토스트,팝업  (0) 2021.04.28
(SwiftUI)13.TextField  (0) 2021.04.28
(SwiftUI)12.커스톰 탭뷰  (0) 2021.04.28

+ Recent posts