I'm loading products for my app from Network every time the user opens an app.
My viewDidLoad looks like this:
override func viewDidLoad() {
super.viewDidLoad()
viewModel.loadProducts()
}
loadProducts func loads an Array of products
let products: [Product]
I want my app to save the previous array so in case of loadProducts() fails I will initialize products from phone local storage.
What are my steps to achieve that? and is it hard to do?