you're a great programmer, and teacher, I am an IOS Engineer and I still come to see your videos as day one, and still buying your pay courses I can say they were a great assets for me getting my IOS Engineering JOB a few years back, even when I have a computer sciences degree. thank you a lot for all your hard work.
@andreiamza1846 жыл бұрын
I can't believe it. Your videos are so on point man. Great job. Every single time you focus on the most important aspects of the swift development. I am so grateful that I subscribed to your channel from the beginnings. I have learned a lot of stuff and I can't imagine how important is your content for me and for sure for everybody. Keep up working because I am sooooo sure that you will hit us with much more than you have accomplished till now :))
@ajaygirolkar88806 жыл бұрын
You are the person who created the most worthy video, which explains all important topics in very less time. You really focus on the main content and fundamentals. Watching your videos is just like watching any suspense Hollywood movie where you can't miss even single line else you will lose the content. Great Job Brian Voong!!
@ayanchakraborty90555 жыл бұрын
one of the greatest explanation over generics i ever got.
@cinquain05 жыл бұрын
I think I finally understand this video after literally watching it a dozen times.
@polinavetrova55742 жыл бұрын
OMG, thank you so much, i was looking for how to make my code more universal, now i'm in love with generics!)
@Johnged156 жыл бұрын
Thanks a lot Brian I have many sources to learn iOS development but you’re one of the top instructors. Your goals and FAQ for the channel are exactly what keeps me coming back to your videos. Great work as usual.
@paulsarbu58716 жыл бұрын
Thank you, Brian! I really enjoy the more advanced tutorials that you did in the past few weeks. I realized how much I repeat myself in my code and this will help me streamline my code by a lot.
@joesminis5 жыл бұрын
You are such a powerful instructor. Thank you.
@Dennisvm826 жыл бұрын
A pretty complex part of programming, but this is exactly what I want to start using from now on. Thanks for the clear explanation of how this works :-)
@LetsBuildThatApp6 жыл бұрын
Awesome, if anything just seeing the syntax in action should make all of us curious what else we can do with Generics.
@Soh9653 жыл бұрын
That was intense- Challenging concept once in a while. Thank you
@bennychewDev5 жыл бұрын
Just got this implemented in my project! My preference is to name T and U, Cell and Entity respectively though. More clear to me. I was getting pretty fed up with the longgg collection view controller code, good to abstract away this stuff, so it will be easier to make list views. Thanks so much Brian!
@BenPatterson116 жыл бұрын
Love the video Brian! Really trying to advance myself from Mid to Senior level developer and Generics has always been something I "will get around too" but this was a great video! Really opened my eyes up to the power of Generics!
@ersinergul6635 жыл бұрын
Now it's make sense to make generic custom boiler plate codes on Xcode :) You are great man. Thanks!
@JohanAlbrectsen6 жыл бұрын
I think this video raised my IQ by like, 5 points
@danialsview6 жыл бұрын
Oh yes thank you Brian! I knew what was generics but didn't know where to use them so here they are 🎉
@firstjamesryu6 жыл бұрын
This is really nice, Brian. Thank you so much. I looked at lots of articles and videos about generics and this video really helped me understand it. Thank you again.
@williambrandin13964 жыл бұрын
Hey Brian, I know this is an old vid but it's super helpful! Could the logic be applied for a table view with different cell types each with their own data source? Thanks!
@prataprana29632 жыл бұрын
Great video sir..btw How would i handle button target or callbacks in cell for row ?
@_DeProgrammer6 жыл бұрын
Needed this Brian thanks, I had a few tableviews that held different products and I tried to to make a base tableview because I new it was bad to repeat myself but didn't know how to get around registering and dequeuing different cells then like always Brian comes to the rescue
@imMehtab4 жыл бұрын
That is an awesome video! But I have a question. What if we have multiple TableViews in a single view controller and multiple custom cells in a single TableView ?
@kaipingtseng42486 жыл бұрын
Brian you save my day over and over again !! Thanks for your videos : D Bless from Taiwan 🇹🇼
@hectormejia4996 жыл бұрын
Love it!! Please keep the advanced swift videos coming!
@adincebic29926 жыл бұрын
You started making videos about generics at the right time for me. I learned a lot from you. The only thing that I don't like is when you start making a lot of classes in the same file because it sometimes gets messy and confusing. Also, why don't you close the inspector pane? :) Anyway, I think your channel is the best place to learn advanced iOS development.
@badalshah99956 жыл бұрын
Adin Ćebić i think he is creating in same.viewcontroller only 4 video purpose because it will good for us. If we forgot some variable reference then we can easily identify them if it is in same viewcontroller.
@LetsBuildThatApp6 жыл бұрын
Exactly correct. Recording a video and going back and forth between multiple files would drive everyone crazy.
@sami7903116 жыл бұрын
Another great video!!! Would you please add to this sequence handling multiple UITableViewCell's?
@JohanAlbrectsen6 жыл бұрын
Omg Brian you’re making me a more advanced Developer by the day! Can’t express my appreciation enough in one comment, but I hope u know that!!! Can u do a vid about what parts of IOS you can specialize in? I want to become an expert IOS Developer, and I am pretty good, but I want a part of the SDK which is MY part. A part that I know like my own room. What does employers want?
@kelvinfok6 жыл бұрын
Thanks for the video. VERY VERY helpful! Now I'm going back to my production apps to fix all those code duplication!
@arvidurs6 жыл бұрын
Lets say I have a thumbnail and a list cell which render the same item array. Using generics, how would I register both cells? And also by clicking a button in the UI change the type of cell which should be displayed to toggle list view or thumbnail view. Hope that makes sense
@MissaMelodica5 жыл бұрын
I always appreciate how you start off with "I hope you're having a great day." Let me tell you Brian... I am having an awesome day. Hope you have a great day too!
@delmarz6 жыл бұрын
Hi brian! Thanks for your video I learn alot from you. Do you have some best API Client setup for latest using Alamofire? Thanks
@IphoneGameHelp6 жыл бұрын
Hi Brian, I was wondering if there is a way to introduce multiple different sections in the UITableViewController with different generic cell types?
@chuddywarrior79964 жыл бұрын
late reply, but u can probably just morph the daya into a nested array ex: [[cell, cell,cell], [cell, cell]]. Where the arrays.count represents the number of sections and array[i].count represents the number of rows.
@albaqawi6 жыл бұрын
Amazing application abs super cool lesson where you use a a generic to be applied as parameter in another generic. This made things so super clear. Also happy 4th Brain! 🇺🇸
@alialnaghmoush6 жыл бұрын
The lesson is wonderful, I wish you make another lesson as a new example on the same subject
@sanjayarun49474 жыл бұрын
This reminded me of the time when i was trying to make sense of protocols and delegates.
@jeffa.23786 жыл бұрын
Absolutely fantastic !!!! I'm going to implement this right away. Thanks !!
@QiOS2836 жыл бұрын
superb demo about generics in Swift. I have the used the same but in my app the UITableDatasource model data are different but having same structure. How to use generics for UITableDatasource.
@tubex13006 жыл бұрын
Hi Brian You saved my times in this episode love it Thanks
@glebcherkashyn23576 жыл бұрын
wow that's awesome! thanks for sharing your best practices
@douglassantos1756 жыл бұрын
Real good explanation! thank you Brian.
@davidlintin5 жыл бұрын
Hi Brian, Many thanks for this informative tutorial. I am, however, struggling with figuring out this method with sections I've set up my sectioning as below; enum AccountSections { case account ...etc } enum AccountRow { case login ...etc } struct AccountSection { var section: AccountSections var accountRow: [AccountRow] } If you could, can you please point me in the right direction. Many thanks.
@LetsBuildThatApp5 жыл бұрын
This technique of generics won’t work for multiple sections unless you configure a multidimensional array.
@denniszenanywhere6 жыл бұрын
Thinking after attending web dev bootcamp last year , I want to learn iOS app dev. Is it harder to learn?
@abcabc1111abc6 жыл бұрын
Hi Brian, thanks for such wonderful video. I have a doubt that is in place of having the fixed data source. I wanna use fetch results controller to display my core data object.... How can we use generic cell example in that case... Thanks in advance
@LetsBuildThatApp6 жыл бұрын
You'd simply append onto the items array after your core data fetch, and reloadData on tableview.
@abcabc1111abc6 жыл бұрын
Thanks for the reply Brian.. my intention of using the fetch result controller was to use the delegates of fetch results controller, that would avoid complete reload of table view after initial data source has been loaded.
@LetsBuildThatApp6 жыл бұрын
Oh yeah if you're using FetchedResultsController you'll probably have to do something different.
@AlexKalinkin5 жыл бұрын
Thanks, You can rid the second generic parameter, and instead, you can set the let items: BaseCell.U type for items in BaseViewController
@LetsBuildThatApp5 жыл бұрын
Do you have any code for this?
@6957-c5k2 жыл бұрын
Wonderful tutorial
@osmanmusse62235 жыл бұрын
Thanks Brain your a very good teacher god bless you
@bennychewDev6 жыл бұрын
This is awesome stuff. Thanks Brian!
@hectormejia4996 жыл бұрын
Love it, now I wonder how would you (or anyone here) allow for multiple cells to be registered?
@LetsBuildThatApp6 жыл бұрын
I would use a different technique of providing the tableview with a view model/datasource of cells and items. You can dig through LBTAComponents to see how this is done.
@hectormejia4996 жыл бұрын
ahh thank you! I might actually give your pod a try!
@byhabiboff4 жыл бұрын
Love you Brian!
@phthphat4 жыл бұрын
Awesome, that's what I'm looking for, thank you so much
@ManNguyen-ij8ky6 жыл бұрын
Question: How can I implement header into this. Not all tableview would have header but when I want do have header how do I modify this generic base table view class?
@dosbol3546 жыл бұрын
Thank you for interesting topics, but I am little confused. I heard a lot that you should not update view from itself and view must not know about any model. But you set data in view on itself. Is this correct way? It's not critics, I am just really interested in learning.
@LetsBuildThatApp6 жыл бұрын
Yes, there are many different architectures you can choose from. This video is simply showing you the plumbing that can be put in place using Generics. You can modify the logic here to fit whatever model you're looking for.
@VRVitaly2 жыл бұрын
great tutorials. 100% value 0 Fat
@iamuzoola6 жыл бұрын
Hi Brian, awesome video as always. Really like your teaching style. BTW, is it possible to use generics to handle problems like one collection view using multiple types of cell. For example, a collection view has dogCells, CatCells or birdCells. Currently, I use an array to store all cellIdentifier and writing a bunch of downcasting or class checking code, which is pretty annoying. Or maybe there is any better solution? Thank you so much.
@LetsBuildThatApp6 жыл бұрын
I was a little curious about the multiple cell scenario, I think its best to simply use a custom initializer that takes in an array of cell classes: class MultipleCellTableVC: UITableViewController { let cellClasses: [BaseCell.Type] var items = [Any]() init(cellClasses: [BaseCell.Type]) { self.cellClasses = cellClasses super.init(nibName: nil, bundle: nil) cellClasses.forEach { (c) in let className = NSStringFromClass(c) tableView.register(c, forCellReuseIdentifier: className) } } //Override this in your subclass func cellClassName(for indexPath: IndexPath) -> String { let cellClass = cellClasses[indexPath.section] return NSStringFromClass(cellClass) } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return items.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let identifier = cellClassName(for: indexPath) let cell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath) as! BaseCell cell.item = items[indexPath.row] return cell } required init?(coder aDecoder: NSCoder) { fatalError() } }
@vakhtangiberidze5286 жыл бұрын
yap have a same question
@iamuzoola6 жыл бұрын
Awesome, I'll try this. Thanks Brian!
@Permaculture-Power6 жыл бұрын
Great stuff Brian!. Would you be able to do a short video walking through this code? I am still getting my head around generics and seeing it in action would really help. Thank you
@bennychewDev5 жыл бұрын
For multiple cell types in 1 collection view you can also try IGListKit. It's pretty nice! Only draw back is you'd have to use class instead of struct for your model.
@vk88276 жыл бұрын
Great video! How to load cell from xib with generics ?
@vk88276 жыл бұрын
thanks, but already found solution
@MultiSimransingh4 жыл бұрын
What if I m working on UiViewController not TableViewController ?
@ayon35276 жыл бұрын
Man after the dog cell i got lost, have to watch it again😀. But as always you are the best
@shoebmoin106 жыл бұрын
Even i want to be a android / ios developer like you, right now doing android development since six months gonna do some ios soon 🤘💪
@xfabiosoft6 жыл бұрын
Can i use the power of generics in Objective-c app?
@alexr3d6 жыл бұрын
Really good explanations !!
@adirburke9216 жыл бұрын
Hi Brian, Can you please help, I am trying to create a Generic ViewController with some static functions so I don't need to retype them in all my ViewControllers. It compiles but it crashes every time class GenericViewController : UIViewController { override func viewDidLoad() { super.viewDidLoad() } static func storyboardInstance() -> T? { let s = String.init(describing: self) let storyboard = UIStoryboard(name: s, bundle: nil) return storyboard.instantiateInitialViewController() as? T } } class welcomeScreen : GenericViewController { }
@ModMyTech6 жыл бұрын
Amazing work buddy!
@Gojam125 жыл бұрын
Thanks for the awesome tutorial sir
@magic0x06 жыл бұрын
Thanks for the great tutorial 🙏🏻
@jisanson5 жыл бұрын
Amazing video 👏
@sagarmore94255 жыл бұрын
Hey brian, can you please make video for handling different types of UITableViewCell.
@neklasoctan86815 жыл бұрын
I can help y. But could y describe more about this? That mean how you want to handle, where? .. Just in tableview or else?
@Gojam125 жыл бұрын
So it is possible to put a viewcontroller in the appdelegate class?
@LetsBuildThatApp5 жыл бұрын
I don't exactly know what the question means.
@jaasterdev63446 жыл бұрын
Loved it!
@joshuageronimo52196 жыл бұрын
Great video as usual! 🔥🔥🔥
@andy_skerjie6 жыл бұрын
Awesome video. Thanks
@XecuttioneR6 жыл бұрын
I’m assuming this approach wouldn’t work if you have different UI Elements in each cell? For example you have two uiviewcontrollers, the first shows uitableviewcells that have a uiimage and uilabel, and the other cell has 2 uiimages. How would you configure each one using generics? Would they have to have the same elements?
@LetsBuildThatApp6 жыл бұрын
Yes, this works only for a single cell table view. You can expand the code on your own to support multiple cells.
@tiojoe_5 жыл бұрын
Thank you so much for this awesome pearls! Bless
@vijaykharage6 жыл бұрын
Question: How can we use didSelectRow(at:) method to push specific viewController?
@jshyam096 жыл бұрын
Hi Brian, i'm having the same question, how to handle didSelectRow?
@dungtranvan60316 жыл бұрын
use closure
@glebcherkashyn23576 жыл бұрын
you can create function in base class something like handleCellSelection(), call it in didSelectRow and override handleCellSelection() in subclass
@vijaykharage6 жыл бұрын
yes did the same. thanks btw
@ff2165 жыл бұрын
you can override didSelectRow function
@chmziaurrehman6 жыл бұрын
Another great video 👍🏻❤️
@ryantemple35026 жыл бұрын
If you wanted to register multiple cells for a BaseTableVC generically would it make sense to make create BaseCells as an Array or a dictionary with [cellId:BaseCell]
@LetsBuildThatApp6 жыл бұрын
For multiple cell types, I believe you could use a Generic Cell Class Array for BaseTableVC. For the identifiers, you could use a simple trick of registering cells with the actual class name. Its even MORE advanced, but maybe I'll go over this trick one day.
@ryantemple35026 жыл бұрын
Lets Build That App what’s the reason for using a seperate cellId for a cell instead of just using the class name as a string? It seems like the latter is more simple
@LetsBuildThatApp6 жыл бұрын
Yes, thats what I meant, simply use the cell class name as the id.
thank you sir.. also hope to get your paid courses.
@tanggu95105 жыл бұрын
thank you
@cinquain05 жыл бұрын
Generics are actually straightforward, not sure why it took me so long to get it
@LetsBuildThatApp5 жыл бұрын
It takes a lot of good examples to really see what the point is
@TamTuyet476 жыл бұрын
Great !
@TamTuyet476 жыл бұрын
Can you do it with collectionview. I tried but it's not succeed
@sesu98266 жыл бұрын
I did with both collectionView and tableview. To create Generic collection view you have to implement a little more code but it gives us more flexibility : ~~~~~~~~~~~~~~~~~ - setup in didFinishLaunchingWithOptions method the fallowing code : ~~~~~~~~~~~~~~~~~ let layout = UICollectionViewFlowLayout() layout.scrollDirection = .vertical window.rootViewController = SomeController(collectionViewLayout: layout) ~~~~~~~~~~~~~~~~~ - create custom textLabel (or whatever you want) and do not forget to add it as cell subview and align it inside the cell: ~~~~~~~~~~~~~~~~~~~~~~~~ class CatCell: BasicCollectionCell { let myLabelText: UILabel = { // created custom label let label = UILabel() return label }() override func layoutSubviews() { super.layoutSubviews() backgroundColor = .red addSubview(myLabelText) // added to superview myLabelText.fillSuperView() // set constraints to its superview } override var cellItem: Cat! { didSet { myLabelText.text = cellItem.name } } } ~~~~~~~~~~~~~~~~~ - conform your BaseCollecitonView clase to UICollectionViewDelegateFlowLayout protocol, and setup the sizeForItemAt method whatever you want: ~~~~~~~~~~~~~~~~ func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { return CGSize(width: collectionView.frame.width, height: 50) } The rest of the code is the same as our BRILIANT TEACHER did in this video tutorial, obviously you have to implement numberOfItemsInSection & cellForItemAt exactly in the same way as Brian teach us. PS: By the way, great stuff Brian !!!
@TamTuyet476 жыл бұрын
thanks
@ismailtosun75806 жыл бұрын
awesome ! Thanks a lot =)
@leolu24983 жыл бұрын
是否有该视频demo的源码呢?
@cinquain05 жыл бұрын
I finally grasped this video after watching it a 4th time
@huahuapro5 жыл бұрын
thanks from china
@doffydonqouite75196 жыл бұрын
Hi brian ! Good day
@bhagyashingale56633 жыл бұрын
MemoryLayout and pointers is the most advanced swift code i've seen
@eloh64346 жыл бұрын
Brian you is lit.
@rasheshbosamiya14826 жыл бұрын
Thank$
@MrBionik66 жыл бұрын
Hey Brian, really good video as usual. But I don't think that putting the model directly in your UITableViewCell/UICollectionViewCell subclass is a good idea. Sure it's a convenient and fast way for configuring the cell but you should extract that to another object because the view should't be aware of the model. Here is an excellent resource: www.swiftbysundell.com/posts/preventing-views-from-being-model-aware-in-swift Cheers
@LetsBuildThatApp6 жыл бұрын
Yep there are a ton of more advanced architecture patterns that you can apply here. From the code we've seen in this video, you can modify the dequeue process to do whatever you please with the generic cell class. Feel free to expand on the logic here. Remember I'm only showing the way, the destination is yours.
@MrBionik66 жыл бұрын
Yeah sure, maybe you should start some videos about intermediate-advanced development techniques.
@meerasayabu38236 жыл бұрын
If you ask me to name some subtitle for your youtube channel, I will name it as "SPREADING KNOWLEDGE".
@LetsBuildThatApp6 жыл бұрын
Knawledge
@tieda6 жыл бұрын
早
@LetsBuildThatApp6 жыл бұрын
早!你应该住美国吧
@tieda6 жыл бұрын
我在加拿大。最近有没有新的付费课程上线?准备放弃Storyboard了,就靠你了。xD
@albertlu84076 жыл бұрын
聰明的選擇
@mrosenberg212 жыл бұрын
Are you for hire for IOS App dev? Looking for a complex new social media app. Combines many of the aspects that many of the most popular apps have today all into one.