Posts

Post marked as solved
8 Replies
18k Views
Hello, I'm trying to save some Strings in a csv document: var tempString = String() for Rezept in alleRezepte { tempString += "\(Rezept.name), \(Rezept.description), \(Rezept.nutrients), \(Rezept.whatToDo)\n" } let dirs = (NSSearchPathForDirectoriesInDomains(.documentDirectory, .allDomainsMask, true) as? [String]) let path = dirs?[0].appending("rezepte.csv") let url = URL(string: path!) do { try tempString.write(to: url!, atomically: true, encoding: String.Encoding.utf8) } catch { print(error) } print("Daten gesichert")And I get this error:CFURLCopyResourcePropertyForKey failed because it was passed an URL which has no schemeError Domain=NSCocoaErrorDomain Code=518 "The file couldn’t be saved because the specified URL type isn’t supported."How can I fix this?Thank you for helping.
Posted
by p.knausst.
Last updated
.
Post not yet marked as solved
6 Replies
2.7k Views
I have an app where I use the UICollectionView to show images of different cars. Once a user selects a car the picture is animated infinitely until the user selects another car. For this I use the isSelected() method.After a restart of the app I want the animation to continue on the last selected car.I already have saved the index of the last selected car and now I want to get access to the specific cell in the viewDidLoad() in order to resume the animation. Is this the correct approach?if let selectedCarCell = carCollectionView.cellForItem(at: IndexPath(row: 0, section: 0)) as? CarSelectionCollectionViewCell { print("Got access to cell") }
Posted
by p.knausst.
Last updated
.