I cannot store and retrieve values, texts or data // Planner App

Hi. I want to make a planner app that has the date and location of the project. Only I have a problem. I used a "DatePicker" so that the date is counted. Only I do not know how to save and display the selected date.

In general I have problems to save and reload the content of the variables and texfielders etc. I thought that these contents are automatically saved on the end device of the user.

I have read that there are methods like "UserDefaults", "CoreData" or "AppStorage". Have been reading stuff about this forever. But I can't get this to work. I hope someone would like to donate their time to help.

Greetings Janik

I want to make a planner app that has the date and location of the project.

What platform are you targeting?

What UI framework are you using?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hello, I am using SwiftUI and would like to publish my app on iPhone beforehand.

SwiftUI offers a variety of different ways to manage storage. The correct option to use depends on the specifics of the data:

  • How important is it? Is it a like a preference, so if it gets lost then it’s no big deal? Or is it critical user data?

  • How much data are you dealing with? It is just a few values? Or maybe hundreds of values? Or maybe thousands?

  • And are those values small? Like a string entered by the user? Or large? Like a photo?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hello, The data are very important. These are data like a certain time, place or contents of a list. Mainly it is small strings that users enter.

But I would like to add documents later.

The data are very important.

OK. That’s key. Things like UserDefaults and AppStorage are intended for storing preferences, not for critical user data. Your options for critical user data are:

  • Core Data

  • Documents

  • A file that you manage yourself

IMO Core Data is probably overkill for your requirements. You then have to choose between the last two options, and that really depends on this:

But I would like to add documents later.

SwiftUI has a document architecture and it’d make sense for you to decide whether you want to jump on board that that now or defer that work and create a file-based solution.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Okey, thanks a lot. How do the last two methods work, or where can you look at it?

I cannot store and retrieve values, texts or data // Planner App
 
 
Q