서버 리스폰스 값을 받던 도중
한가지 키값에 대해 경우에 따라 두가지 타입이 들어오는 것을 확인
가장 먼저 드는 생각은
서버 개발자에게....하하하하ㅏㅎ
말도 안되는 생각이란 걸 깨닫고
열심히 찾아봄
swift one key two type....
이딴 검색어를 써넣었음에도 불구하고
놀랍게도 아래와 같은 링크를 내려주시었다.
How do I handle decoding two possible types for one key in Swift?
I have a Codable struct that is used to decode incoming JSON. Unfortunately, sometimes one of its key's value is a string, and sometimes it is a float. I was able to cobble a couple of do/try/catch
stackoverflow.com
감사합니다.
'iOS > Swift' 카테고리의 다른 글
[Swift] CollectionView에서 cell resizing 하기 (0) | 2022.09.06 |
---|---|
[Swift] CoreData에서 Array, Dictionary 사용하기 (with Transformable) (0) | 2020.02.11 |
[Swift] navigationController is nil (in .xib) (0) | 2019.08.29 |
[Swift] Loading Dialogue (0) | 2019.08.09 |
[Swift] Swift에서 xib파일로 작업하기 (0) | 2018.11.08 |