I´m new at programming and I my code gets the error: fatal error: unexpectedly found nil while unwrapping an Optional value 2017-10-27 16:06:16.755817+0200 Inspireme1.0[836:8530
Quotes should not be optional.
You need to handle the optional outcome in viewDidAppear rather than assuming quotes will always unwrap.
quotes = defaults.codable(RandomItems.self, forKey: "quotes") ?? RandomItems([])
In viewDidLoad:
defaults.set(codable: quotes, forKey: "quotes")