Memory 4 - Fixing Common Memory Problems: Reusable Popups (iOS, Xcode 9, Swift 4)

Поделиться
HTML-код
  • Опубликовано: 17 ноя 2024

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

  • @yuraoff1383
    @yuraoff1383 6 лет назад +6

    Thank you very much!
    You can use instead 'protocolName: AnyObject {}' that's 'protocolName: class {}'

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад +3

      You're welcome! This is originally how I was going to teach it, using class instead of AnyObject. But when I was confirming with Swift documentation it was just mentioning AnyObject so I decided to go with that instead. Maybe I should have mentioned both...
      This is good for others to know, though so I'll pin your comment! Thanks for commenting!

    • @cylenalag
      @cylenalag 6 лет назад

      Apple's suggestions tend to be quite vague and as seen here around 30:00 that it leads to non-error errors. Go figure!

    • @TanyaBerezovsky
      @TanyaBerezovsky 6 лет назад

      According to Apple, since swift 4 it should be AnyObject check it under the Class-Only Protocols section: "You can limit protocol adoption to class types (and not structures or enumerations) by adding the AnyObject protocol to a protocol’s inheritance list." goo.gl/AYb4Pv

    • @PavelPalancica
      @PavelPalancica 6 месяцев назад

      protocol SomeProtocolName: class {} is now deprecated. We can use AnyObject or NSObjectProtocol.

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

    man. your channel is like a gold mine. Thanks for all the effort that you put in these videos. You can't find this type of quality content anywhere else

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

      Thank you so much! I'm happy you like them. 😃

  • @emiclark
    @emiclark 5 лет назад +1

    My second time watching the memory mastery series. So many things clicked and fell into place. Thank you for taking the time to show each solution and running it on the simulator, visually showing what was going on.

  • @mazenbaddad7474
    @mazenbaddad7474 6 лет назад +1

    you know mark there's a lot of people searching for (retain cycle) and can't find this video you should add #RetainCycle # Swift , you the only one who explain this with details , I can't thank you enough , and some time I feel like you know about swift more than apple do 😂

    • @bigmtnstudio
      @bigmtnstudio  5 лет назад

      Thanks, Mazen! I took your suggestion. 😃

  • @glennadams7047
    @glennadams7047 5 лет назад +1

    No doubt the best explanation of Swift memory management. Good mix of theory and practical tips. Thanks Mark !!!

  • @stevengao8345
    @stevengao8345 6 лет назад +4

    it always been a tremendou pleasure to watch your video tutorials, delegation and memory leaks have always been a complicated topic for me to learn, and thanks for clear them up for me. just a future suggestion: there is another topic about Generics , something create an universal type which also very confusing but very essential topic, whenever you have time please consider make one for us. thanks

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

    really thank u very much about this , i never have been saw a creative person like u in explaining the part of memory management

  • @dosbol354
    @dosbol354 6 лет назад +2

    Thank you Mark very much, now I can understand ARC, memory leak etc. It was difficult to find great tutorial like these episodes.

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      That's awesome, Dosbol. Glad I could help!

  • @anandnimje5750
    @anandnimje5750 6 лет назад +2

    Thanks for these kinds of Tutorial series.I have clear my doubt about Memory management. While creating the app I didn't think about this kind of memory leaks. Now I do. Such a Great tutorial. 👌🏻 👍

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      Awesome, Anand! A lot of times I don't catch memory leaks until it's too late...like a year too late. Ha ha ha.

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

    Thank you! Your courses are awesome 👏

  • @dhavalnena7386
    @dhavalnena7386 5 лет назад

    THE CONTENT OF THIS TUTORIAL IS PRICELESS! LEARNT SO MUCH FROM THIS... THANKS A LOT!

  • @sandeep19831000
    @sandeep19831000 6 лет назад +1

    I had the same problem with Observer (12:00) .and my project used to crash like you shown here . Thanks for this detail explanation Mark.

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      You are welcome and I'm glad it helped!

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

    Thank you so much @MarkMoeyKens this was a very clear explanation of memory management that can be done in our app. So can you also do a very clear video of TDD process in iOS development??

  • @nagarajukankanala6397
    @nagarajukankanala6397 6 лет назад +2

    Thank you very much, learn lot of stuff from this videos.. great work.

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      You're welcome, Nagaraju. Glad I can help our little iOS development community here on Earth. 😃

  • @muhammedazharudheen2252
    @muhammedazharudheen2252 6 лет назад +1

    hey those who want to dig on memmory leaks. a mine is here. great work sir.

  • @farmood100
    @farmood100 6 лет назад +1

    Thanks for providing this great video. This is very helpful for us to understand the retain cycle & memory concept in IOS

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      You're welcome, Mohd. It's a pleasure to assist my community!

  • @patbutler5546
    @patbutler5546 6 лет назад +1

    I enjoy your videos, good Sir. Please keep them coming.

  • @fawadfarooq
    @fawadfarooq 6 лет назад +2

    fantastic , marvellous ,fabulous, outstanding , easy , superb, fantabulous,extraordinarily,Wow,Great !

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      I'm so glad you enjoyed this series! I normally don't go into these types of subjects but I had to teach something about memory and then it turned into its own series. This was a tough one to teach and keep as simple as possible at the same time. But I think it paid off!

  • @neelamdheeraj
    @neelamdheeraj 6 лет назад +2

    Thank you so much for this. Really learned some cool stuff.

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      You're welcome, Dheeraj! Glad it was useful for you. 😃

  • @markarjohnsanantonio1615
    @markarjohnsanantonio1615 6 лет назад +1

    They won't be running out of salt for years lol! Great video, I am guilty with the NotificationCenter haha! This way I can do some testing to make sure I don't create memory leaks, also that deinit is really handy. This is food for the brain, thanks!

  • @pavanm2024
    @pavanm2024 6 лет назад +2

    Awesome tutorial

  • @nabinrai980
    @nabinrai980 6 лет назад +1

    Really good. Thank you.

  • @KMamedoff
    @KMamedoff 6 лет назад +2

    Love your videos!

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад +1

      Thanks, Kenan, I appreciate you watching them and glad if they help you out! 😀

  • @rasheshbosamiya1482
    @rasheshbosamiya1482 6 лет назад +1

    Thanks for this tutorial series.

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад +1

      You are welcome, Rashesh. It was probably the hardest series I ever created but I think it was worth the time because it's an important subject.

    • @rasheshbosamiya1482
      @rasheshbosamiya1482 6 лет назад

      Its been two year I get into iOS development. I keep on doing betterment in each project in aspect of Code Structure, OOPs principles etc. But crucial thing memory management, thats what you explained with demo app. I appreciate. Thank you. :)

  • @MarlAtkins
    @MarlAtkins 6 лет назад +2

    Excellent! Thank you

  • @Th-fr3fw
    @Th-fr3fw 6 лет назад +1

    Hi! Thanks for your videos, they are very helpful! Which macbook model are you using? I want to buy one for ios development but dont know exactly which one I shold go to feel comfortable in developement.

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад +1

      Thank you, Fabin!
      I'm using a 2014 13" Macbook Pro with a 256 GB SSD and 8 GB RAM. If you're just starting out then I would go with something cheap or used. That's what I did when I was first starting out. Xcode has worked well for me on low resources. Just remember to minimize the number of scenes (view controllers) on your storyboards. 😉You can easily do this with storyboard references (see my storyboard tips videos).

    • @Th-fr3fw
      @Th-fr3fw 6 лет назад

      Thanks for your advice! Maybe I'll choose Air 2017 for starting out. Ye, I've already watched almost all your videos. They're very useful, keep doing!

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад +1

      Wow, I'm impressed! Thanks for watching. 😀

  • @shaktiprakash1723
    @shaktiprakash1723 6 лет назад +1

    Hey Mark ,you are Awesome ,all your tutorial are easy to understand and easy to implement ,Great Job,I have one doubt
    i have created a table view in my custom pop ups ,on table view did select i am dismissing the modal controller and passing data through delegate ,but that dismissing action is very slow

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      Thanks, Shakti. I try to make them easy as possible. That's how I like to learn.
      Do you still have the slow dismissing of your popup?

    • @shaktiprakash1723
      @shaktiprakash1723 6 лет назад +2

      i just dissmissed it in DispatchQueue in main thread everythings worked

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      Awesome! That actually makes sense. When I'm doing UI stuff not in the main thread then I see delays.

    • @shaktiprakash1723
      @shaktiprakash1723 6 лет назад

      Thanks Mark ,it really motivates a lot .

    • @sandeep19831000
      @sandeep19831000 6 лет назад

      Hi Shakti late a bit . Do all your UI stuff and user interaction in main thread ..other things you do in background thread.Always make free your Main thread to take User input as well as update the UI(this advise i got from Core Data Specialist Marcus Zara's one of video)

  • @ErickMartinSusanto
    @ErickMartinSusanto 6 лет назад +1

    Actually when you try to using capture list with [weak self] to avoid the optional inside closure you can use guard. Hope it helps

    • @bigmtnstudio
      @bigmtnstudio  5 лет назад +1

      Yeah! Guard is awesome. That's one of the first things I do now.

  • @di_nerd_apps
    @di_nerd_apps 5 лет назад +1

    yo was it hard understanding all this at first? or u been programming for while so it was easy

    • @bigmtnstudio
      @bigmtnstudio  5 лет назад

      I've been programming for a while but in other environments/languages. I knew some of the things but I find what happens is when I go to teach something I start to recognize gaps in my knowledge. So I had to study and fill in all those gaps! This was originally going to be one video. But as I started to put together the outline, it just grew and grew into a 4-part series. I actually worked my way backward to find a good starting point to introduce the basics so I could better move into the more advanced topics.

  • @dmadhukiranraju7458
    @dmadhukiranraju7458 6 лет назад +1

    Thank you very much for this tutorial really helped me a lot, I will keep this tricks in mind
    I faced the same problem before and I fixed it
    protocol protocolName : class {
    func funName();
    }
    and declare like this in the class
    weak var delegate : protocolName?

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

    Mark . I had an interview for junior developer , they asked me about difference between unowned and weak ))) i explained 1 by 1 as you teached but they went further and started to break me :D it is not complete answer and etc . and then wich answer would be complete ??)))

  • @nickng8069
    @nickng8069 6 лет назад +1

    I've come back to most of my tutorial apps and added in [unowned self] everywhere I could xD

  • @kell7491
    @kell7491 6 лет назад

    how about static class? is that same thing with singleton? using static class inside the closure?

  • @glebcherkashyn2357
    @glebcherkashyn2357 6 лет назад +5

    thank you for your videos! i wish i could leave 10k likes

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад +1

      You're welcome! I would love 10k likes! 😃

  • @viktorkuzmanov3086
    @viktorkuzmanov3086 6 лет назад +1

    On purpose I did not fix the first memory leak in Notification Center and run the tool you showed us in this memory series that checks for leaks and it didn't find any but It should've. Is the tool not working or I am missing something ?

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      I notice this happens sometimes too. The tool seems unreliable at times. Sometimes I have to do a Clean on the project (Product > Clean). And other times I've had to restart Xcode! ☹️

  • @brazo98
    @brazo98 6 лет назад +2

    So, dude when I am unsure I take always weak right? Thx

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      Yeah, Brazo, exactly. I even know a former Apple employee and he always uses weak and nothing else. He just does't see the point in taking any chances at all.

  • @TheDancing0wind
    @TheDancing0wind 6 лет назад

    When you first set 'observer' object to weak linked - who is holding a strong reference to it?
    if it is not strong then it should be released as soon as you instantiate it. (Well it will not as memory manager does not react instantly, but if you put it into an auto release block it should).
    I see it working but I'm having a hard time understanding why it is?
    Edit: Oh yeah (I'm primary an ObjC guy :) ) - observer is linking to NSNotificationCenter default singleton - singletons internal property is what holding the strong reference. If you created a new normal object - it would go bye bye immediately after creation. weak linking stuff in closures is the only correct way.

  • @MasteRock87
    @MasteRock87 6 лет назад +1

    Sometimes i use callbacks in a network asynchronous calls, so if i set self as unowned in the closure parameters i get crashes as self gets deallocated when users navigate away from the view controller, is it recommended in that case to set it as weak?

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      Exactly! What can happen is you reference self in your closure and that code in the closure is actually part of your other class, not self. So self can be deallocated but still be referenced in the other class that owns the closure. So later (after your view controller is deallocated) the code in the closure (part of the second class) can get run and you will get the crash. If this can happen then that's when you'd have to go with weak.

  • @brazo98
    @brazo98 6 лет назад +1

    Dude you write if let observer = observer is that still true? Like 1 : 1? I am a litle bit confused about that! Could you explain me that? Thanks!

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад +1

      It's not always true, no. If the value on the right side of the = is nil, then it returns false and you don't go into the code in the braces { }.
      Example:
      var myOptional: String? = nil
      if let myValue = myOptional {
      // False: Code won't be run because myOptional is still nil
      }
      myOptional = "I now have a value"
      if let myValue = myOptional {
      // True: Code WILL be run because myOptional has a value
      }
      Hope that helps!

  • @mohammadtahir7931
    @mohammadtahir7931 6 лет назад +1

    Really gReat!

  • @SenorQuichotte
    @SenorQuichotte 6 лет назад

    Use delegates, deininit, viewwilldisappear

  • @BBrezonak
    @BBrezonak 6 лет назад +1

    Solved error message
    stackoverflow.com/questions/24066304/how-can-i-make-a-weak-protocol-reference-in-pure-swift-without-objc

  • @ngoclichtran4876
    @ngoclichtran4876 6 лет назад +1

    almost your videos is belong to Storyboard for creating UI .

    • @bigmtnstudio
      @bigmtnstudio  6 лет назад

      Yeah, when doing a tutorial I like to give the viewer a visual on what they'll be seeing. Also, another RUclipsr, Brian Vong, covers coding UI extensively. So this provides balance. 😃

    • @ngoclichtran4876
      @ngoclichtran4876 6 лет назад

      I think I will use tools for UI :D

  • @ghousansari6578
    @ghousansari6578 6 лет назад

    I checked your tutorail but worked for a small code for me and I am not able to determine on my app which I made. I get many memory leaks report not able to identify what is the exact issue. Please check this link screenshots of my memory report
    ibb.co/ji2rAd
    ibb.co/kMxrAd
    ibb.co/echDOy