Array (class) filled with non nil values stays empty

前端 未结 1 595
-上瘾入骨i
-上瘾入骨i 2021-01-29 12:09

I am currently having trouble filling up an array of customClass.

I try to fill it with a jsonFile. During my json parsing (using swiftyJSON) i loop and fill my array. T

相关标签:
1条回答
  • 2021-01-29 12:37

    Change your JSONAnnotationList declaration to be an non-optional and assign it an empty array

    var JSONAnnotationList: [UGOAnnotation] = []
    

    You see, you have never created an array so there was nothing to be printed.

    The whole point of optionals is to use them sparingly, not everywhere.

    0 讨论(0)
提交回复
热议问题