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
Interested in iiOS? Lets connect! linkedin.com/in/afrazsiddiqui
This was really lovely tutorial 😍
Thanks
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.
Can you use LRU cache too so when it gets too large it kicks out the one not used for the longest time?
absolutely
Really helpful. Thanks for Sharing
Can we get all cache images?
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.
Thanks a lot!
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?
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!
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
Heh, glad you got into the auto layout train 😈
Haha yep
Great tutorial thanks for your time. Is there any video about Operations in swift in your channel?
Yes, soon
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
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
Sure
Please make videos on SwiftUI and Async/Await/Actor/MainActor, etc
Will do
@@iOSAcademy Please make a Network Call as well, Restful APIs example as well.
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
-let's see if I can get away with just copying and pasting
-looks like I can
- Dream of every programmer
🤣
😂😂 Story of my life
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.
OS will notify you
Thanks broooooooooooo
Youre welcome
Nice video. The BG color of the imageView is not showing because you accidentally set widthAnchor twine instead of setting the heightAnchor.
yeah I realized that after haha
I used to cache download image from url
Same!
@iOS Academy bro make a video How to display Real Data In Chart Month weak 👍
actually, using the url as a key always do the trick so that call will always be reusable for more than 1 request
Sir can we use NSCACHE on images present in assets ?
Doesn't make too much sense unless the images are so large and take time to load.
@@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 .
@@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
@@pqsk sir the requirement is I have to make 13 api calls simultaneously and get the data
@@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.
🔥
Thanks
please create more video about obj-c app ios. thank very much
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
You dont have to clear memory when the resources is low. It handles that part.
@@rabinpun3691 what ?
@@rabinpun3691 what resources? this nscashe lives in ram, the same as dictionary
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😂
@@afaaqahmedsaqi i guess you never worked on real project