Swift: My Secret to Fixing Fat View Controller: Subclassing

Поділитися
Вставка
  • Опубліковано 3 лис 2024

КОМЕНТАРІ • 124

  • @danialsview
    @danialsview 6 років тому

    It's really hard to find architecture or design pattern tutorials they generally talk about it theoretically,
    Thank you! I've learned​ a lot from you

    • @HeathersHighlights
      @HeathersHighlights 5 років тому

      I agree! I spent hours over the last day or two trying to find good examples without much luck. This video was so great!!

  • @jeffa.2378
    @jeffa.2378 6 років тому

    Fantastic !! And yes, more of that please !!

  • @prasadsanaboina557
    @prasadsanaboina557 4 роки тому

    Thanks bro very nice tutorial I am following your tutorials since 2017 every video is worth and I am learning something new in every video.

  • @viralchauhan9397
    @viralchauhan9397 6 років тому

    Thanks, I like this type of refactoring video, Which is easy to maintain and provide robust code

  • @amitkumardas5650
    @amitkumardas5650 6 років тому

    This is super cool stuff. It's been almost 2 years since I started following your channel. It always bring a smile. Thank you Brian. Please consider making UA-cam like view controller dismissal tutorial.

  • @TokyoXtreme
    @TokyoXtreme 6 років тому

    These are the kinds of videos I like to see the most, despite the low-level of “sexiness”. This kind of information can’t really be found in Apple documentation, and seeing the refactoring and optimization first-hand is really what people need to see. Good stuff, good stuff.

  • @vijaykharage
    @vijaykharage 6 років тому

    Used subclassing in my project and literally reduced 98 lines of code 😅 and counting. Thanks a ton Brian. Always teaches new stuffs that are really important in real life.

  • @hectormejia499
    @hectormejia499 6 років тому

    love it! More advanced techniques are always welcomed.

  • @albincr
    @albincr 6 років тому

    This video is very helpful, awesome.. Hoping to see more refactoring video

  • @rajapurva2012
    @rajapurva2012 6 років тому

    Yes. More of these videos. It's extremely helpful.

  • @jamesanyanwu154
    @jamesanyanwu154 3 роки тому

    I enjoy your videos a lot, please keep u the good work

  • @Arophous
    @Arophous 6 років тому

    Awesome vid Brian - got me thinking more about tidying up after myself!

  • @furqanahmad2670
    @furqanahmad2670 6 років тому

    Yes please create more such videos.

  • @MrFarmerarmer
    @MrFarmerarmer 6 років тому

    Please keep doing this kind of video Brian! This has been a great lesson for me into the importance of refactoring.
    As someone that’s fairly new to coding, I need great videos like this to guide me and to give me an idea of what a job in iOS development would be like.
    Your videos have been so helpful to me over the last couple of months, I can’t thank you enough!

  • @tesleemamuda
    @tesleemamuda 3 роки тому

    Thank you for this Brian!

  • @OmarAli-iy4tw
    @OmarAli-iy4tw 6 років тому

    These videos are awesome, keep them coming.

  • @JonathanBijos
    @JonathanBijos 6 років тому +2

    These types of videos are the most productive for me (:
    Great job, Brain

  • @Amazuro
    @Amazuro 6 років тому

    Really do like your video's. There is always something I learn new :)

  • @joshr9723
    @joshr9723 6 років тому

    Yes, please keep these kind of videos coming!

  • @luismigelgb
    @luismigelgb 6 років тому

    I just wanted to drop by to say that I enjoyed this video! I liked seeing how you work through these tasks.

  • @DanielZielinski
    @DanielZielinski 6 років тому

    This tutorial - great! Please more of that. Increased the the quality of my code so much!!

  • @faisallikespotatoes
    @faisallikespotatoes 6 років тому

    Extremely helpful - I’ve been in the process of writing cleaner and more loosely coupled code while I’ve been tasked to create a project from scratch at work, and these videos are insanely helpful!!

    • @simrandotdev
      @simrandotdev 6 років тому

      I have created this starter project for my own use which uses MVVM.
      Feel free to use it and ask me questions if you have any. I am using XIBs, but you do not need to do any of that. Only dependency is Alamofire.
      github.com/simransdsu/Books-iOS

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +1

      Very nicely written repo, abstraction is clean.

    • @simrandotdev
      @simrandotdev 6 років тому

      Lets Build That App thanks a lot Brian, that means a lot to me.

  • @Theasstasticvillain
    @Theasstasticvillain 6 років тому

    These are excellent, I feel like I'm hitting a wall with your content and I need more advanced stuff. Please keep it coming.

  • @patrickmcdaniel8272
    @patrickmcdaniel8272 6 років тому

    Keep up the great work Brian. These lessons are extremely valuable!

  • @rickeyhrabowskie9683
    @rickeyhrabowskie9683 6 років тому

    Great video as usual. I personally would like to see more.

  • @smackaroony
    @smackaroony 6 років тому +1

    your thumbnails are on another level

  • @SatanicBoomBoomHead
    @SatanicBoomBoomHead 5 років тому

    I liked this tutorial and I would like to see more of these type of videos.

  • @carloszetula2307
    @carloszetula2307 6 років тому

    Excellent video as well as others on this channel. I want to program like you, one day! Thank you very much!!!

  • @bibinjacob123
    @bibinjacob123 6 років тому

    Hey Brian, your last episode about advanced swift generics was really awesome. Would love to see more of those advanced stuff and maybe animation stuff like CADisplayLink. 👍🏻

  • @captaintech8337
    @captaintech8337 3 роки тому

    Thank you very much for your amazing video.

  • @ohenecokerful
    @ohenecokerful 6 років тому

    That was very helpful! Thanks!

  • @israelmanzo8725
    @israelmanzo8725 6 років тому

    Hi Brian, Thanks for this great tutorial. I am learning a lot with these. I would like to see more refactoring code videos. Best!

  • @Doped4
    @Doped4 6 років тому

    Thanks for the video. I always learn something new. Would be nice if you keep doing that kind of stuff. ✌🏻

  • @nursultanaskarbekuly4032
    @nursultanaskarbekuly4032 5 років тому

    awesome video Brian! please bring more of these.
    the overall logic seems similar to how components are used in react.

  • @gokalpaltun7883
    @gokalpaltun7883 6 років тому

    Impressive Brian.

  • @jaasterdev6344
    @jaasterdev6344 6 років тому

    Once again thanks for the epic video :)

  • @furqanahmad2670
    @furqanahmad2670 6 років тому

    This is for what i was looking for. Thank you brain ❤️

  • @Dennisvm82
    @Dennisvm82 6 років тому

    You are my hero :D all this refactoring is so much fun to do! Learned a lot again today :-)

  • @melaniemint7757
    @melaniemint7757 6 років тому

    Hey Brian, You requested we let you know if we like these ‘code heavy’ videos. I generally like them, this one in particular was very useful for me. But, don’t feel pressured to do them all the time or anything. 🙂

  • @ssdev1652
    @ssdev1652 6 років тому +13

    nice stuff..
    it's weird, your videos almost always come when i need them - i wanted to do counting animations in my app for some time and now i know how - thank you ;)
    ps. are you planning to do a bigger course antyime soon?

  • @DavidJohnson-hb6gh
    @DavidJohnson-hb6gh 5 років тому

    Always a genius! Good work!

  • @javadbacker481
    @javadbacker481 6 років тому

    Much Thanks.
    Appreciate the video content and the video.

  • @jorgecasariego
    @jorgecasariego 6 років тому

    Thanks Brian!

  • @samlee405
    @samlee405 6 років тому

    Amazing as always Brian.

  • @subinrevi2268
    @subinrevi2268 5 років тому

    Hey Brian, would really like to see more advanced tutorials which applies the OOPS concepts. Completely understand the difficulty of making short videos for these kind of topics. I guess a real world project applying these concepts would be really awesome. It is better to create a course than a video tutorial. Anyways thanks for all the effort you are putting in.

  • @jisanson
    @jisanson 4 роки тому

    My favourite video of the channel so far. I find this topic totally sexy lol. Thanks for all the great contents!

  • @paulsarbu5871
    @paulsarbu5871 6 років тому

    I actually like this videos more than the others because it teaches some of the best practices in iOS programming with Swift.
    What I am very interested in is to see how you would organize a large iOS project with the refactoring described in this video, in terms of groups, folders, etc.
    At the moment I am working alone at a project, but I would like to know what I should do to make my project 'team proof' by implementing a healthy git workflow.

  • @Huggmuth
    @Huggmuth 6 років тому

    Loved it!

  • @ФарабиБимбетов
    @ФарабиБимбетов 6 років тому

    I like your videos! Thank you!!!

  • @opwr
    @opwr 6 років тому

    Loved the video, thanks! I was struggling with this lately as well.

  • @thompheijffer6379
    @thompheijffer6379 6 років тому

    Very good video, I really like it!

  • @P_F_D
    @P_F_D 6 років тому

    thank you for this, I picked up a lot of great tips!

  • @mkhasson97
    @mkhasson97 6 років тому

    That's awesome 👏🏻👏🏻👏🏻
    I hope that you create a intermediate course: iOS 12 about animation & CoreData relationships please 😍😍😍😍😍😍

  • @darachi8201
    @darachi8201 5 років тому

    thanks! I need this

  • @arnaudDR400
    @arnaudDR400 6 років тому

    Thanks Brian, your videos are great! you're doing them nice and clean, it's impressive how professional they are.
    Regarding Swift, I'm coming from Objective C which I learnt on my own, just for the fun of it. Switching to Swift is kind of "weird" to me: sometimes I feel like this "??!!???!" notation is disturbing, to say the least... I'm gonna browse thru your videos and see if I can find some explanation about these optionals that will make sense to me.
    Thanks a lot, once again, brilliant work !
    Arnaud

  • @mandeepsarangal5910
    @mandeepsarangal5910 6 років тому

    I loveeee you man!!!!!

  • @Blatherer325
    @Blatherer325 6 років тому

    I LOVED this video!! I would love to see this but in a more advanced version. Where you refactor an app with more complexity in each view controller. Lets say a VC with various async network requests with a tableview. Perhaps the youtube app?

  • @TravisSiebenhaar
    @TravisSiebenhaar 6 років тому

    Good job Brian! I've searched through all your videos and I haven't had success finding a video that demonstrates how you would setup/structure your files for a real application. If you have done a video on building an application that has a professional structure like MVC, MVVM, etc please link it and I'll be sure to watch and like.
    ps. I like these videos and would not have a problem if you kept them coming!

  • @rajdhakate617
    @rajdhakate617 6 років тому

    Very nice coding practice ✋🤚

  • @ChrisWitko
    @ChrisWitko 6 років тому

    great videos!!!

  • @ayon3527
    @ayon3527 6 років тому

    Reality informative, Brian txa lot!

  • @Zainanjum100
    @Zainanjum100 6 років тому

    awesome video want to see more keep it up

  • @melodiessim2570
    @melodiessim2570 4 роки тому

    Great video! Really interesting and always gives me new ideas for my app :p

  • @shubhamtomarspst
    @shubhamtomarspst 6 років тому

    Awesome

  • @afroshinigaminerdzila4264
    @afroshinigaminerdzila4264 5 років тому

    👋 hey brian... awesome videos.
    Could you please show us how to create a menu app?

  • @aliasadi2550
    @aliasadi2550 6 років тому

    miss you brian

  • @iasplay224
    @iasplay224 6 років тому

    ss dev literally had this problem and Was going to tweet if you could make a video about keel the good work

  • @prabtanimehul
    @prabtanimehul 6 років тому

    Hey Brain, I really like your channel and find it's really useful. Can I request you to post a video on MVP architectur please.

  • @tomrogers123
    @tomrogers123 6 років тому

    Great video! I definitely don't subclass enough and need to get into doing it more. I absolutely agree that the display link and animation logic belong out of the main view controller because they are integral to what it means to be a counting label. Therefore, they belong in that encapsulation. However, I'm not so sure about the text alignment properties. To me, the fact that it is centered is a decision made at the application level and so ought to be in the VC. In a sense, this is why I love storyboards; they're a clear demarcation between a view itself (the storyboard representation) and the logic for that view (the VC).
    Thoughts

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +1

      The feature is to build a centered animated label. To get this behavior very easily and precisely, we simply set the textAlignment in init. As a result, we were able to make duplicates of this label without manually centering it again.
      Obviously if you wanted a customizable counting label, you could create a parent class and subclass it again.
      Personally, I find coding much easier since the behavior is clearly defined. Often times, you'll see storyboards items with certain designs but are changed dramatically in code, causing this weird mix thats frustrating to reconcile.

  • @mattesackboy2001
    @mattesackboy2001 6 років тому +4

    You're the best

  • @developerios6096
    @developerios6096 6 років тому

    Hey Brian, was not better keep the reference to your UILabel subclass in the viewcontroller? And make a custom initializer for your stackview which accepts views?The question is: is better to have the view controller or the subclass reusable?

  • @pyaephyoaf
    @pyaephyoaf 5 років тому

    Your videos are as great as always. And I left storyboard bcoz of you. Could you do tutorial about subclassing UIView?

    • @LetsBuildThatApp
      @LetsBuildThatApp  5 років тому

      You can find many examples of UIView subclassing in the latest tinder course.

    • @pyaephyoaf
      @pyaephyoaf 5 років тому

      Lets Build That App Could I ask course related question when I buy that course?

  • @MirasAujan
    @MirasAujan 6 років тому +3

    Thanks for the video, ALWAYS awesome!
    Just a small remark:
    You forgot to add "self.layer.maskToBounds = true" to your UILabel subclass.
    (Not that significant)

    • @MirasAujan
      @MirasAujan 6 років тому +1

      He wanted to implement rounded corners to his UILabels. It is done by calling
      self.layer.cornerRadius = (desired radius)
      self.layer.maskToBounds = true

    • @Кто-тоЕщё-ш3я
      @Кто-тоЕщё-ш3я 6 років тому

      @Frozey self.layer.maskToBounds will crop everything outside round corners

  • @shingetzu88
    @shingetzu88 6 років тому

    Hi brian, great vid! Thank you. I have a question though, how can we apply this for a more complex screen say w/ multiple labels or buttons or images where each one has different properties? Would be nice if you can add a similar vid to your instagram course or podcast course! Thanks a lot!

  • @MirasAujan
    @MirasAujan 6 років тому

    Btw, since you started to talk about clean code, and refactoring, perhaps your viewers would be interested in clean code principles (SOLID). Reading it myself rn, but it would be insightful to learn about your experience with it. Maybe you can share other principles you find useful.

    • @MirasAujan
      @MirasAujan 6 років тому

      Here is a small read if you would like to learn more about SOLID in Swift:
      marcosantadev.com/solid-principles-applied-swift/
      Another cool principle is Composition over Inheritance, the video is based on JS though:
      ua-cam.com/video/wfMtDGfHWpA/v-deo.html

  • @chimung1994n00b
    @chimung1994n00b 6 років тому +1

    Thanks! Can you make a video about recommended structure for real project ?

    • @Dennisvm82
      @Dennisvm82 6 років тому

      That sounds like a great idea! How do big companies structure everything, where do they put comments, file naming, etc.

  • @acjazz01
    @acjazz01 5 років тому

    Depending on the size and complexity of the App, just subclass it's not enough.
    We have to use a good pattern like MVVM or Viper to avoid massive viewcontrollers.

  • @jjkyo3374
    @jjkyo3374 6 років тому

    Hello Brian! How to make the date above the today in the app store? Add label to navigation bar or just add two labels(the date and the today)? And the large title in different device has different position. How to auto layout in all apple devices?

  • @victormagalhaes2821
    @victormagalhaes2821 6 років тому

    How do you handle it in a large project ? Do you have a folder with custom components?

  • @kav04
    @kav04 6 років тому +1

    Thanks Brian for very useful video! Do you use "separate" technic right of the bat or in the beginning you make fat VC then you refactor it ?

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +1

      Good question. I typically add a few lines of code to get things going and to make sure the new feature works. I will refactor at the end to clean up everything.

  • @alexN350z
    @alexN350z 6 років тому

    Another way is to solve fat view controller problem to use design pattern VIPER, can you do a video on that topic?

  • @AliAbbas-ui8ur
    @AliAbbas-ui8ur 6 років тому

    great job
    could you explain the implementation of html+css forms within ios app

  • @srsh12345
    @srsh12345 5 років тому

    Is there anything really different when applying the same code refactoring to UI elements that have a target. Like buttons, gestures and sliders?

  • @yuriyfedchenko977
    @yuriyfedchenko977 6 років тому

    Please make more lessons with refactoring

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому

      I'll try to come up with more ideas on refactoring videos as they are very useful for folks on the channel.

  • @t19960804
    @t19960804 6 років тому

    Hi Brian
    what's the difference between "init(parameters: class)" and "override init(frame: CGRect)"

  • @shrikantupadhyay890
    @shrikantupadhyay890 6 років тому

    No please don't stop making this kind of videos because no one in youtube/any Online course is teaching this stuff

  • @maverix2006
    @maverix2006 6 років тому

    What do you think of Vyper?

  • @t.rreddy4083
    @t.rreddy4083 6 років тому

    Yes please

  • @andreiamza184
    @andreiamza184 6 років тому

    More, More, More =)

  • @zackjensen4484
    @zackjensen4484 6 років тому

    More design videos😜

  • @dhanashekaranm4725
    @dhanashekaranm4725 6 років тому

    can u make a video to fetch data from firebase to flutter app plzzzz!!!

  • @jujubaclothing
    @jujubaclothing 6 років тому

    lol I can watch you refactor code all day. no homo

  • @andriap6462
    @andriap6462 6 років тому

    How about Alamofire Subclass?

  • @applepie7282
    @applepie7282 5 років тому

    BESSSTTT BABA

  • @maverix2006
    @maverix2006 6 років тому

    I propose a SWIFT Vapor course

    • @simrandotdev
      @simrandotdev 6 років тому +1

      He has mentioned multiple times in his Live Streams that neither he is familiar with Server Side Swift neither he likes XCode for server side development. That is why he created a short NODEJS series.

    • @LetsBuildThatApp
      @LetsBuildThatApp  6 років тому +1

      Glad somebody is listening during the Live Streams :)

    • @simrandotdev
      @simrandotdev 6 років тому

      That's why I have all your paid courses and waiting for a Podcast or Instagram course in Kotlin as well. Would not wait for more than few seconds to buy it.

  • @natelee8671
    @natelee8671 6 років тому

    It seems you forgot just one line of code "self.layer.masksToBounds = true" if we wanna make "self.layer.cornerRadius = 5"

  • @むむ-o1m
    @むむ-o1m 3 роки тому

    wow

  • @zaneoliver8832
    @zaneoliver8832 6 років тому

    Keep the coding Videos!

  • @bibinjacob123
    @bibinjacob123 6 років тому

    Isn't it actually called massive view controller?

    • @Blatherer325
      @Blatherer325 6 років тому +1

      Bibin Jacob Pulickal arbitrary name, insert synonym for large here: View Controller

  • @applepie7282
    @applepie7282 5 років тому

    YOU