Basic way doesn\'t work.
for index in 0 ..< list.count { if list[index] == nil { list.removeAtIndex(index) //this will cause array index out o
Now in swift 4.2 you can use
list.compactMap{ $0 }