Swift Tutorial: Save & Get Data with User Defaults

Поделиться
HTML-код
  • Опубликовано: 24 июл 2024
  • Let's explore how to save and get data in an iOS app using UserDefaults. User Defaults are a great and simple way - built right into iOS to accomplish this task.
    💻 Source Code: / iosacademy
    🎥 Subscribe for more: ruclips.net/user/iOSAcademy?su...
    😎 Like my teaching style? Check out some of my most popular courses!: courses.iosacademy.io
    iOS Academy offers the #1 course for iOS Development for Beginners. Learn to create iPhone and iPad apps from scratch. Everyone these days has an app idea; learn the important skill of making those apps, make yourself more marketable, change industries to get a different job, and enjoy the ride!
    This video is brought to you by Skillshare - an only community of teachers sharing awesome skills. Use the following link to get 2 months of FREE premium: www.skillshare.com/r/user/afraz

Комментарии • 40

  • @jiayi4154
    @jiayi4154 4 года назад +3

    Thank you so much for the content! It's very helpful!

  • @samhoward9390
    @samhoward9390 3 года назад

    Great video! Question: If I'm passing a string from a textview to be displayed on a separate view's textview through the prepare method (using segue identifiers and all that) would I implement this code on the destination view controller's swift file? Also, my data passes and displays correctly on the destination's textview.

  • @anthony6841
    @anthony6841 4 года назад +5

    i love your channel please continue these great videos!

    • @iOSAcademy
      @iOSAcademy  4 года назад +1

      Thank you so much! I plan on it :) Stay tuned

  • @luckcfm
    @luckcfm Год назад

    Great video and great teacher. Im learning alot from your vids. Thanks a lot. A hug from Brazil 🇧🇷

  • @dineshkhatri3859
    @dineshkhatri3859 2 года назад

    best video on youtube.Short and on point

  • @danielvides1741
    @danielvides1741 3 года назад

    This was a good tutorial, I liked how you explained things!

  • @bitsurfer0101
    @bitsurfer0101 3 года назад +2

    What would you recommend using if I wanted to save around 200 movie quotes in a database? Core data or something else?

  • @alexandermiller6583
    @alexandermiller6583 2 года назад

    I have a question about the limitations of user defaults: if I were needing to store like several months worth of text data and have it display that data on a graph, it is appropriate to use this method? The context is on a workout app where you can input your weight and reps and I want it to save that data and show it back to the user on a different tab

  • @michaelkang7933
    @michaelkang7933 3 года назад

    Do you recommend using User Defaults to store the account details of a User after logging into our app, for example?

  • @samsaah1815
    @samsaah1815 2 года назад

    Great videos, keep making them and we will keep on coming back....

  • @celsojuniosimoesdeoliveira6576
    @celsojuniosimoesdeoliveira6576 2 года назад +1

    Thanks!

  • @MaxCBPCenter
    @MaxCBPCenter 3 года назад

    big like from me too. I can listen to you way easier than to my prof. thx

  • @weebpianoguy720
    @weebpianoguy720 3 года назад +2

    I have 3 questions (sry) :
    Number 1: if i wanted a UITextField to have the value of the String how would that work because i tried it and it didn’t work
    Number 2: How could u save a image or a video?
    Number 3: Could u make a video on an exporting function like a pdf etc...
    Thx love ur vids!!

  • @_fapple_
    @_fapple_ 3 года назад +4

    its insane to me how fast you fix your errors. When i get an error, as a beginner i gotta look it up. Keep up the great content, its helped me tremendously through learning swift!

    • @iOSAcademy
      @iOSAcademy  3 года назад +1

      Thanks! Its all in the practice

  • @achintbhamra6701
    @achintbhamra6701 2 года назад +1

    kindly make a video on bundle ID. great content 🔥😁

  • @Evan_anish
    @Evan_anish Год назад

    Good job.

  • @psharis914
    @psharis914 2 года назад +1

    That was complicated bro for beginners... i like your other tutorials but i think i have to watch another tutorial for userdeafults

  • @applentonio1376
    @applentonio1376 4 года назад +1

    I coded following App with your video (ruclips.net/video/E6Cw5WLDe-U/видео.html) now I want to save both entries from the AddViewController with UserDefaults.
    But I have no idea how, please help me

    • @iOSAcademy
      @iOSAcademy  4 года назад

      Hey there, you need to first start by getting the values out of the fields with a field.text. Then pick a userdefault key, as shown in the video, to save it. Something like this: UserDefaults().standard.set(myValue, for: "myKey")

    • @applentonio1376
      @applentonio1376 4 года назад

      @@iOSAcademy In the AddViewController we are having two textfields a title and a body, is the UserDefault in the AddViewController or in the ViewController, if it is in the ViewController where do I set/get them

    • @iOSAcademy
      @iOSAcademy  4 года назад

      @@applentonio1376 UserDefaults are shared app wide. They are not different across 1 or more view controllers. If you create UserDefaults.standard as seen in the following docs, it will be the same object across the entire project: developer.apple.com/documentation/foundation/userdefaults

    • @applentonio1376
      @applentonio1376 4 года назад

      @@iOSAcademy I've testing it for the past few hours and I can't find the right way to do it. Is it possible to show you my Code via TeamViewer or something like that?

  • @yikeli878
    @yikeli878 3 года назад +1

    Very useful content, thanks! But the zoom effect is kind of distracting, maybe just highlight.

  • @chingunk294
    @chingunk294 3 года назад

    these zooms are annoying and makes me nauseous

  • @sandhyanallamilli2842
    @sandhyanallamilli2842 Год назад

    Stop Zooooooming pleaseeeeee