how can i save checked rows of tableview in userdefault?
问题 I'm facing the same issue as asked in this question: how can i store selected rows of tableview in nsuserdefaults in swift 3 However, I'm interested in knowing how to repopulate with the saved rows that have been checkmarked? Thank you! 回答1: Create a variable with didSet so that we can reload table once the value is assigned to it. var selectedRows: [Int] = [] { didSet { myTableView.reloadData() } } On viewDidLoad() assign value to selectedRows from userDefaults override func viewDidLoad() {