NSCache: Performant iOS App Basics (2022)

Поделиться
HTML-код
  • Опубликовано: 9 фев 2025
  • In this video we will be taking a look at NSCache to make your app more snappy and performant. NSCache allows your app to intelligently manage cached data - avoiding memory issues - in a thread safe manner. We will do a real world example with fetching images in Xcode 13 and Swift 5.
    💻 Source Code: / iosacademy
    🎥 Subscribe for more: www.youtube.co...
    😎 Like my teaching style? Check out some of my most popular courses! courses.iosaca...
    👉🏼 Connect (personal LinkedIn) / afrazsiddiqui
    🚀 Follow on LinkedIn / ios-academy
    ** Popular Series
    Building Instagram: courses.iosaca...
    Building TikTok: / @iosacademy
    SwiftUI for Beginners: ios-academy.te...
    ** Get Skillshare free for 2 Months and learn iOS
    www.skillshare...
    ** Manage all your investments from app earnings on Betterment!
    bit.ly/3eBwlI9
    ** Grow your own RUclips tech channel with TubeBuddy:
    www.tubebuddy....
    #swift #cache #iOS

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

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

    Interested in iiOS? Lets connect! linkedin.com/in/afrazsiddiqui

  • @afaaqahmedsaqi
    @afaaqahmedsaqi 2 года назад +6

    This was really lovely tutorial 😍

  • @pqsk
    @pqsk 2 года назад +2

    Today I learned that after instantiating NSCache you can set the countLimit and give a hint on the totalCostLimit. You can even use NSCache with NSPurgeableData to have a little more control. I know this video was more like a brief intro, but thought I'd share this to anyone who wishes to research some more on their own.

  • @Jannemandevries
    @Jannemandevries 2 года назад +2

    Can you use LRU cache too so when it gets too large it kicks out the one not used for the longest time?

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

    Really helpful. Thanks for Sharing
    Can we get all cache images?

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

    Very helpful video. Hi Afraz can make a video on top of iOS LLDB debugging and other types debugging too. Also SSL pinning if possible.

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

    Thanks a lot!

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

    I am just wondering do i need if i am using sdwebimage libary or kf lib , do i need nscache for example cell.config(model: model) method inside tableviewdatasource method?

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

    Hi, if you can, could you make the video about study tree for good ios developer.? I mean the shbjects that I have to learn!

  • @АлексейГуляев-в9э
    @АлексейГуляев-в9э 2 года назад

    This is very cool! How i can cache my model for example model pie recipe at two hours, if a can show my pie recipe, i show cached recipe and save cached data on file on disk, if a go out my app. Two hours later i can send request on server api and cached and save on disk for show on screen. If time don't up, i show my recipe for cache

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

    Heh, glad you got into the auto layout train 😈

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

    Great tutorial thanks for your time. Is there any video about Operations in swift in your channel?

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

    Hi, would you continue the Instagram app? Because it’s an amazing course, I hope you add the chat and stories, it will be really cool, waiting so much other videos about it

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

    Can you make video about when you should write [weak self] and when you don’t. I understand that you should write out when reference cycle can be but it’s so hard to know

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

    Please make videos on SwiftUI and Async/Await/Actor/MainActor, etc

    • @iOSAcademy
      @iOSAcademy  2 года назад +2

      Will do

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

      @@iOSAcademy Please make a Network Call as well, Restful APIs example as well.

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

    One Question : i create Class Called CustomTextField so i will be used many should i use init or convenience to create constructor of class which i use init or convenience

  • @dannybones9484
    @dannybones9484 2 года назад +2

    -let's see if I can get away with just copying and pasting
    -looks like I can
    - Dream of every programmer
    🤣

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

      😂😂 Story of my life

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

    How to set memory restrictions say about 1gb so, if storage goes beyond the limit app notifies to us and other operations can be performed.

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

    Thanks broooooooooooo

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

    Nice video. The BG color of the imageView is not showing because you accidentally set widthAnchor twine instead of setting the heightAnchor.

    • @iOSAcademy
      @iOSAcademy  Год назад +1

      yeah I realized that after haha

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

    I used to cache download image from url

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

      Same!

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

      @iOS Academy bro make a video How to display Real Data In Chart Month weak 👍

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

    actually, using the url as a key always do the trick so that call will always be reusable for more than 1 request

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

    Sir can we use NSCACHE on images present in assets ?

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

      Doesn't make too much sense unless the images are so large and take time to load.

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

      @@pqsk sir I have one more unique requirement, I have only 1 year experience and for the current task I have to call 13 apis at once get the data and then reload the collection view present inside table view . When I am passing the array of data models to the cell class after parsing some of the data is going and some is nil, but all parsed data models are printing the data. Pease help .

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

      @@EscapeToVictoryNow I'm not so sure I understood that completely, but you have to make sure when you return the cell from *tableview cell indexPath* that you're reusing the cells appropriately and loading the cell each time. If you have your data cached just put it in the cell each time that is called

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

      @@pqsk sir the requirement is I have to make 13 api calls simultaneously and get the data

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

      @@EscapeToVictoryNow for 13 different cells? Is it because they each take some time to load? You can try to use GCD and use a concurrent queue, but be mindful of resources.

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

    🔥

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

    please create more video about obj-c app ios. thank very much

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

    stupid cache - that is just dictionary. that doesnot store it to the memory, also your callback is already in mainqueue - there is no need to use it second vc

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

      You dont have to clear memory when the resources is low. It handles that part.

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

      @@rabinpun3691 what ?

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

      @@rabinpun3691 what resources? this nscashe lives in ram, the same as dictionary

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

      Imagine you are loading 100,000 images, then what you will do? Your mobile app will become NASA's app.😀you will need super computer😂

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

      @@afaaqahmedsaqi i guess you never worked on real project