0

My view controller display the view depends on an array. the object of the array may be removed according to user interaction. So i have to reload the view controller once the user delete data in the array. is there any way to reload the regular view controller?

ray ray
  • 115
  • 2
  • 11

1 Answers1

0

You should design the view according to the array in one method and call it every time the array changes.

private func setupView() {
   ...
   self.setNeedsLayout()
}

private func deleteObject() {
   myArray.removeAtIndex(2)
   self.setupView()
}