This code: dataArray = [[jobs: ctlelems[x], unload: 0]];is replacing the whole content of dataArray with the single element array. It does not work as Insert.To append an element to Array: dataArray += [[jobs: ctlelems[x], unload: 0]]or dataArray.append([jobs: ctlelems[x], unload: 0])Found nil is another problem. You use too much unwrapping operators (!), without checking the optional value is nil or not.Put nil checking code before using !.
Topic:
Programming Languages
SubTopic:
Swift
Tags: