So I'm working on a savings app using a table view controller. I ran into an error, and I couldn't find a fix.
if let sourceViewController = sender.source as? SavingsTableViewController, let saving = sourceViewController.savings {
let newIndexPath = IndexPath(row: saving.count, section: 0)
saving.append(saving)
SavingsTableViewController.insertRows(at: [newIndexPath], with: .automatic)
}
The error shows up as Initializer for conditional binding must have Optional type, not '[Savings]'
Thanks for the help!