Wow, you done it again Mark. Just when I needed to swipe rows into my current project, you produced a very detailed and clear explanation of the method used. Just love this channel man. Thank you - again!
Hey Mark thanks a lot. I found a loophole to change the color of the image. Instead of using an image, you can use the emoji keyboard on the title. ❌ and ✅ looks really cool. Anyways, thanks for the tutorial!
A couple of things : 1) tableView(_:leadingSwipeActionsConfigurationForRowAt:) and tableView(_:trailingSwipeActionsConfigurationForRowAt:) are methods of UITableViewDelegate and not UITableViewDataSource as you mentioned 2) and they are both supported only from iOS 11 Anyway a great tutorial, thanks!
Thanks for the clarification, David! I just learned something about extensions now. I thought if you did extension ViewController: UITableViewDataSource { then you wouldn't be able to put UITableViewDelegate within the braces. But it looks like you can! You can mix and match functions DataSource and Delegate functions between the extensions. I guess that makes sense now since it treats it as all once class anyway. Thanks, again!
Mark Moeykens I’ve incorporated much of what you have explained into my little TO DO app that was part of an online course i started July 1 (absolute beginner in IOS and swift) and its now looking pretty sweet. I can edit the row text, reorder them and delete the entries.
Hi Mark, Excellent Job!! Is there any way to add the leading and trailing effect on the section cell form viewForHeaderInSection method. Can you explain how it works internally? And whats the replacement method for below iOS 11.
I don't think there is a built-in way to swipe section headers. Here is the original WWDC video where they introduced the new swipe actions: developer.apple.com/videos/play/wwdc2017/204/ Before iOS 11 you only could swipe to the right unless you programmed or used third party code. It was a tableview editing style. Here's a link for more info: www.andrewcbancroft.com/2015/07/16/uitableview-swipe-to-delete-workflow-in-swift/
This is wonderful. Great information. Can you do a part 2 showing how you are able to swipe left or right and select approved users to go to specific lists?
Awesome, Josiah, I'm glad you like the video. This is a great suggestion for a video. But it might be a long time before I get to it. I'm planning a HUGE series coming up. Probably over 20 videos. Check out what I have planned: www.patreon.com/posts/upcoming-course-17364917
It is possible u could email me your section of that code so I can use it as a guide? I have the swipes working I just cant access indexpath.row. I am guessing I need to do something...When I do selectrowat i can access indexpath.row so i am not sure why i cant when i am using the swipe gesture.
Hi! I know it's been a year since this video was posted but have you found anything on not making the images for actions not white? I really learned a lot from this video! Thanks!
Thank you! That happened to me once. It was because my image was too big and it pushed the text all the way out of the frame. Make your image smaller and see if that helps.
@@jedan5lik , to debug this, I might start with removing the image first. Then see if the text is even showing up. After the text shows up, start with a really small image, like 10x10 and see what effect that has. Then increase it until the text disappears so you know how big it can get. You can also try increasing the height of your table view cell and see if that makes a difference. Give your table view row a large height just to see if you can get both the text and image in the swipe action to show, then start to decrease the row height until you start to see problems.
@@bigmtnstudio Thank you very much for answer. My "heightForRowAt" was 83 and it didn't work. with height 91 or higher it works. As far as I can see, there is no problem in the picture, because I reduced it to 5x5. Problem is in the "heightForRowAt".
Hey Mark. That was excellent. Your videos always makes it easier for me. Thank you. I think ‘.destructive’ style contextualAction can be swiped all the way. And ‘.normal’ style can only be swiped half way. I could be wrong.
Excellent video. In one interview I was asked about shallow and deep copying in swift. And what is happen when Struct has Class instance variable, how this struct will be copied, shallow or deep? Could you make video about that?
Thanks, Aleksei. Have you seen Part 1 of my Swift Memory Mastery series? ua-cam.com/video/Cb1p0a6czGk/v-deo.html This might sort it out a little for you although I don't use the words "deep and shallow" I do talk about what happens when you work with value types (structs) and reference types (classes). Check it out and let me know if it helps!
Hi Alexander, yes, I just completed a couple videos just recently on this. Have a look: Left Swipe to Delete: ua-cam.com/video/XcKDdNa0B_w/v-deo.html Right Swipe to Edit: ua-cam.com/video/PLYdhGyzJwk/v-deo.html
Hi Mark - Terrific video!! After I tap on the button, it doesn't "pop back" into place. I was able to add tableView.reloadData() to the handler to get cell to slide back over. Now need to add some animation to make it clear that the button press worked!
Oh, that's right, Eric! Oh man I can't believe I forgot to talk about that. I even had a comment in my code for the reloadData too! Well I'm glad you figured it out, that's awesome!
Great video Mark. However do you know if anything changed in Xcode 12. I am unable to add both title and image to UIContextualAction. I am only able to added either one of them. Let me know at your convenience.
Hi mark , great tutorial I followed your tutorial and it works great except when i rotate device and change orientation then all the SwipeActions are wrongly placed on cell specially if you do a leading swipe and rotate your device to landscape you will notice this. Am i missing something?
Thanks, Xavier! Oh man, I wish we could do that! I'd love to let the user know row actions exist by programmatically showing them when they first get to the screen. But as of now (iOS 12), there is no way. ☹️
Thanks, Bharat. I have a couple other videos where I take cell swiping to the next step. Including showing an alert and deleting the tableview row and swipe to edit where I open a popup to allow the person to edit: Delete: ua-cam.com/video/XcKDdNa0B_w/v-deo.html Edit: ua-cam.com/video/PLYdhGyzJwk/v-deo.html
hey Mark great video as always, for the image colour maybe you can make the image as render as template in the assets folder and then maybe try to change the colour, I haven't tried them myself but I hope they may work.!
Another great Tutorial, thanks a lot Mark for your time and your willingness and patience to share your knowledge with others. Can you make a Tutorial about editable text in a tableView Cell, like in a to do list app?
Thank you, sir! I can add your request to my list but to be honest, it could be a while because I'm in the middle of a big series right now. I'm 17 videos on and could be another 17 before I end. This will probably be the biggest tutorial series on UA-cam! Ha ha ha
Thank you Mark for the video. Please keep them coming 😀 Can you please make a video on localization, on making an app bilingual covering all type of UI strings in the app
Yeah, Vandan, I wanted it to be a reward to people who support me and my efforts. So I saved the project just for them. Otherwise I don't really have much to exchange with them. I hope you understand!
Hi Gulam, I know this was a long time ago but I have since created another video as part of another series where I go through how to do this. It's part of the Itinerary App Series: ua-cam.com/video/XcKDdNa0B_w/v-deo.html Hope this helps answer your question!
Hi Mark, thank you very much for this video, great work! Very useful and very detailed info. Just can't change the description language coz it's locked...
mark great tutorial! I have just a question: I was wondering if there is a proper way to cancel the swipe left on a tableview cell so that it slides back to hide the buttons. for example I swipe to delete and with alert message I ask confirmation and I press button CANCEL to don't do the action, the swipe action remain visible. I tried with tableView.reloadRow at indexPath, but it reloads the cell BUT NOT THE SWIPE ACTION. I'm desperate, please I would really appreciate your help.
Thank you so much Mark..You are doing great. Sir, Will please make a tutorial about "How to load thousand of Tableview cell inside a TableView" it would help so very much.
Thanks, Mobin! What do you mean by loading thousands of cells. The tableview will handle a large amount of cells but only show as much as it can fit on the device at one time. So it loads just what it can show to save on memory. Are you running into a specific problem?
First of all Thank you so much for replying. Sir let me describe you what I was trying to know. Lets say I have an API which passes some data to the iOS application. Sometime that can be thousand of data. Which I need to display on a table view. So when i try to display thousands of data on a table view it takes like 20-30 (sometimes more) second to load up. Sometime the app crashes. Is it possible to handle those thousands of data in an efficient way? I will be very much helped sir...Every time post a new video first I check the title if its about this... :D :D :D
Mobin Al Instead of loading all 1000 records at once, try Pagination. Set a limit like 50 or so. Load 1st 50 to the datasource array. If user scrolls down and reaches the bottom, add next 50 and reload and so on.
Ohhh, I think I understand better what you're saying (after reading Bibin's comment). I thought you were saying it would take 20-30 seconds to populate the tableview but really it's taking 20-30 seconds to retrieve the data! I was confused because I was thinking once you have the data the population of the tableview is pretty quick.
Here are some videos that may get you started on the right path: ua-cam.com/video/ty_ELVw2cSo/v-deo.html ua-cam.com/video/hnfJlf1vs2A/v-deo.html ua-cam.com/video/XR5KEhQCHYU/v-deo.html
how to set height of these accept or reject buttons etc according to custom container view inside cell i.e I don't want their height equal to the height of cell, I want them to be equal to the custom view inside the cell and and also how to give spaces between these buttons and corner radius to these buttons?
That is a fantastic question! I have looked for a way to do this and find nothing. 😞 It is very much needed and I have submitted a feature request to Apple for it. Feel free to create a feature request too at bugreport.apple.com. We need this!
Finally, memory chapters are over. :) Thank you for showing tableview swiping operation in swift 4. No need for third party libraries now. Hey mark what are your thoughts on MVC,MVVM,VIPER and MVP project structure?
Ha ha, yes, they are over. Yeah, I'm glad we don't have to use third party libraries. They always have the risk of turning into technical debt. I really don't have too many thoughts on project structure because I've been programming for so long that I know that project structure is really just preference and nothing mandatory. It all depends on your needs, your company's standards, how much testing you want to do, how big or how small you want your project to be, how much time you want to spend at separating all responsibilities. I view project structures like this as a scale, kind of like this: Overly Structured Loosely Structured If you're building a prototype then your project may be way over on the right side, loosely structured. You want development to be short just to prove a concept to a client or product owner or manager. A large corporation might be over on the left side (overly structured) where money means nothing to them and you work on a very large team. And on this large team might be certain people that handle just one layer or part of the app. For example, one part of the team (or one person) might just handle all data transactions. They are an expert on interfacing with the data source. Everything is broken down so it can be tested and possibly even it's own project, separate from the main application project. So basically not one pattern fits all. They are good to know about but I've made the mistake in the past of applying overly structured patterns to very simple projects to the point where rapid development was no longer was possible.
First of all great answer! Ohkkk so basically it depends on how large your project is and how that project is gonna divide to developers. So I think if your fundamentals are good for the language you are good to go. You don't need any fancy stuff :) So from now on i will put more focus on fundamentals instead of learning structures. Thanks mark for the explanation. :)
Exactly, Kishan. Also, as you work for different companies, there will most likely be an Architect that will setup the initial project structure for the devs to use.
Thank you! I looked through the constructors for UIImage and it doesn't look like it exists anymore. I found I could do this too: accept.image!.withRenderingMode(.alwaysOriginal) But that didn't work. 😞
My mistake. You're right it's not the initializer but just an instance method. So they are probably preventing us from overriding this in this context. Seems a bit heavy handed. I would consider that a bug and file a radar then because there's no reason it shouldn't obey our rendering mode just because it's a swipe action.
Thanks Mark for the video, it's so helpful to my project but I did perform the delete tableview cell , it removed the cell but the delete button is still there, it won't go away until I scroll the tableview. By the way this is what my codes look like self.tableView.beginsupdate() self.array.remove(at: (indexPath)) self.tableView.deleteRows(at: [indexPath], with: .fade) self.tableView.endsupdate() Thanks !
Mark: Table swipe action seems to work only if the same viewcontroller is not active in a search. The search array populates the same table in the same view controller. Any suggestions to display swipe actions during for a serached table display while the search is active? Thanks, Glenn
Do the images with the text below only work on cells that are 100+ height? Every time I try to do this on a smaller height cell it’s image only. I downloaded the project file and changed the cell height and got image only. I’ve tried this with a tiny image as well 🤔
No Jason, you should be able to supply a smaller image for cells with a shorter height and see both image and text. make sure the actual image file is smaller and not just the black part of the image is smaller.What I mean is you can have a 50x50 image border or frame and make the black image inside of it smaller and smaller while the image frame is still 50x50 inside of Sketch. So, if using Sketch for example, you want to make the artboard smaller (then scale the image to make smaller). I hope this makes sense!
OK, I modified the project in the video and you're right. Here's what I found: * Used a 30x30 image on a 72 pt high cell and no text. * Increased cell high and found the text didn't show until cell height was 91. * Found a bug filed that confirmed this issue: www.openradar.me/33396671 I did some more experimenting and an alternative is you can add the text to the image. This seems to work just fine.
Hi Mark. I have a question. I am trying to build a chat app. I am facing 2 issues with the UI. In the chat screen, i am using a textView in inputAccessoryView for typing the chat message. I want to adjust the height of inputAccessoryView. Is there a professional way of doing this.? Also i am trying to build a Twitter like profile screen. It would be great to see a tutorial on how to do it. Thanks.
Hi Bibin, I'm not sure about adjusting the height of the inputAccessoryView. I'd have to look into it more. As far as the Twitter like profile screen, you might be able to find how it's built in this series that someone else did: ua-cam.com/play/PLy9JCsy2u97kro0jXbXrPFmT-DQVAmNW0.html
Hi Nishant, I don't have a video of how I created this project. I just used the project as an example to present row swiping. There is a link in the video description for the Xcode project. If you're looking for something that shows more on building the app from the start, then you might be interested in the Itinerary App Series on my channel. I go into more detail of starting an app from nothing.
I have a situation where if a user is logged in, I want to show the leading/trailing swipes I've created, but if the user is *not* logged in, I want to display an alert ("You must log in to ..."). It works as expected for the leading swipe, but for the trailing swipe, I see the alert *BUT* I also see the Delete swipe. I can't figure out why... Any ideas?
helloMark, i have a problem ... i wanna access a particular folder form photo library... like Camera Roll, i just created a folder in photo library with name of "CBO". i wanna know that how to access this "CBO" images and display in tableview ... please help me Thankyou :)
ok sir no issue.. thanks bcz in whatsapp i saw thats why i'm asking ... any way no issue can you tell me how to download any file from FTP like filezila
Ha ha, not sure about FTP either. But check out Kyle's video. I'm guessing you'd use URLSession for this and he has a tutorial that covers this topic: ua-cam.com/video/8GH0yMPvQFU/v-deo.html
I found the solution why when you swipe right the ACCEPT action just swipe at half the cell: it's because the style of the action is .NORMAL. if you also put the style of the action .destructive for the ACCEPT action it works perfectly. Maybe they have implemented like that, I don't know why. So the problem is not if you swipe left o right, but if the .style is .destructive or .normal
Sorry about that Gabriel. I didn't think it would be a need at the time but after a couple comments I can see where it might be helpful for others. I'll make note of this for consideration of a Part 2. Right now I'm in the middle of a longer series so it may be a while.
Mark - my fault I got confused with the title "UITableView Row Swipe Actions" I thought with a title like that there would be some actions. Perhaps "UITableView Row Swipe coloured boxes" would be clearer? I am unsubscribing
Hey Gabriel, the next video in my Itinerary App Series deals with swipe actions again and in this video I have code to delete data. I actually show a confirmation alert first and then delete the data and update the tableview with the result. I thought of you and tracked down your comment because I thought you might be interested in this as you were looking for the code of what happens after the swipe action button was tapped. Anyway, here it is and I hope it helps! ua-cam.com/video/XcKDdNa0B_w/v-deo.html I'll try to track down Gulam Ali's comment to and let him know I have more on the subject.
Love your videos. Super clear and perfect pacing for a novice swift programmer as myself. Thanks for all you do!
Best lecturer in Swift History. Simple but detailed. No question left. Carry on don't change anything
Thanks Mark, great Solutions for everything. Best channel ever
Wow, you done it again Mark. Just when I needed to swipe rows into my current project, you produced a very detailed and clear explanation of the method used.
Just love this channel man. Thank you - again!
That's cool, Steve! I'm glad I could be of assistance to my fellow developers! 😃
Thanks a lot, Mark. Watching your tutorial always makes me feel good. There is some different energy in your voice, laugh. Always love it.
Ha ha, that's awesome, Srithan. Glad you like my teaching style. 😊
Great tutorial, still works with Xcode 13 and swift 5. Thanks Mark!
Oh good, I'm happy to hear it's still working!
Great Tutorial. Very clear explanation, easy to follow and understand!! thank you
Thank you, Santiago! 👍🏼
Man, I really really like your videos. Aside from the rich details, the sample projects you're using have cool designs. Thanks!
Thanks you, Mark!
Hey Mark thanks a lot. I found a loophole to change the color of the image. Instead of using an image, you can use the emoji keyboard on the title. ❌ and ✅ looks really cool. Anyways, thanks for the tutorial!
That's some creative thinking, Chris! Good idea. 👍
Mark, Really very nyc video..Learned new features. was not aware of it
That's great, Gunjan! Glad you liked it.
Great video again Mark.
I have learned a great deal from your tutorials.
Thanks!
You're welcome!😀
I missed these tutorials, thanks again! Great tutorial!
You're welcome, Steven. 😄
really helpful tutorial, thank you! The explanation is detailed but not complicated.
Awesome! Glad you liked it!
A couple of things :
1) tableView(_:leadingSwipeActionsConfigurationForRowAt:) and tableView(_:trailingSwipeActionsConfigurationForRowAt:) are methods of UITableViewDelegate and not UITableViewDataSource as you mentioned
2) and they are both supported only from iOS 11
Anyway a great tutorial, thanks!
Thanks for the clarification, David! I just learned something about extensions now. I thought if you did
extension ViewController: UITableViewDataSource {
then you wouldn't be able to put UITableViewDelegate within the braces. But it looks like you can! You can mix and match functions DataSource and Delegate functions between the extensions.
I guess that makes sense now since it treats it as all once class anyway.
Thanks, again!
Hey Mark, Awesome videos! Your channel should have more reach to help out other developers out there.
Thanks, Prasanth! Yeah, the channel is growing slowly. I'm not sure how else to make it grow.
Man this makes an awesome difference to the UI. Thanks heaps.
You're welcome! Glad it helped. 😃
Mark Moeykens
I’ve incorporated much of what you have explained into my little TO DO app that was part of an online course i started July 1 (absolute beginner in IOS and swift) and its now looking pretty sweet. I can edit the row text, reorder them and delete the entries.
Wow, moving right along! That's great to hear. ✊
Nice learning experience! Thanks Mark
You're welcome, Tejas!
Hi Mark, Excellent Job!!
Is there any way to add the leading and trailing effect on the section cell form viewForHeaderInSection method. Can you explain how it works internally?
And whats the replacement method for below iOS 11.
I don't think there is a built-in way to swipe section headers. Here is the original WWDC video where they introduced the new swipe actions: developer.apple.com/videos/play/wwdc2017/204/
Before iOS 11 you only could swipe to the right unless you programmed or used third party code. It was a tableview editing style. Here's a link for more info: www.andrewcbancroft.com/2015/07/16/uitableview-swipe-to-delete-workflow-in-swift/
This is wonderful. Great information. Can you do a part 2 showing how you are able to swipe left or right and select approved users to go to specific lists?
Awesome, Josiah, I'm glad you like the video. This is a great suggestion for a video. But it might be a long time before I get to it. I'm planning a HUGE series coming up. Probably over 20 videos. Check out what I have planned: www.patreon.com/posts/upcoming-course-17364917
It is possible u could email me your section of that code so I can use it as a guide? I have the swipes working I just cant access indexpath.row. I am guessing I need to do something...When I do selectrowat i can access indexpath.row so i am not sure why i cant when i am using the swipe gesture.
Josiah, are you setting the table view's delegate property to self?
If you set a breakpoint in one of the swipe functions, is it getting hit?
I got lucky last night and found a solution. Thank you so much.,
Awesome, good job!
just subscribed. Thanks for the quality content.
Thank you so much, Mehmet! I'm glad you like my videos. 😀
Ah, amazing, Mark!
Exactly what I needed for the project.
Oh that's great! I'm glad I could help! 😀
Great tutorial !!!
As always very clear and precise explanations.
I really enjoy your videos.
Thanks for your effort 👍
You're welcome, Vlastimir! I'm happy you like my videos! 😃
Hi! I know it's been a year since this video was posted but have you found anything on not making the images for actions not white? I really learned a lot from this video! Thanks!
Oh man, I haven't, Joe. Sorry! Glad you liked the video!
No problem! I just had to change my assets a little bit.
@@joenaveau, Oh OK, cool. Sorry for the delayed response too. I was travelling.
Great tutorial, thank you. How can I get the value of a particular label in the swiped cell?
Mark, again awesome tutorial.
after I added the image, the text doesn't display. is there a setting?
Thank you! That happened to me once. It was because my image was too big and it pushed the text all the way out of the frame. Make your image smaller and see if that helps.
@@jedan5lik , to debug this, I might start with removing the image first. Then see if the text is even showing up. After the text shows up, start with a really small image, like 10x10 and see what effect that has. Then increase it until the text disappears so you know how big it can get. You can also try increasing the height of your table view cell and see if that makes a difference. Give your table view row a large height just to see if you can get both the text and image in the swipe action to show, then start to decrease the row height until you start to see problems.
@@bigmtnstudio Thank you very much for answer. My "heightForRowAt" was 83 and it didn't work. with height 91 or higher it works. As far as I can see, there is no problem in the picture, because I reduced it to 5x5. Problem is in the "heightForRowAt".
@@jedan5lik , Oh that's really interesting and sad at the same time that iOS can't accommodate images and text with smaller row heights. ☹️
Hey Mark. That was excellent. Your videos always makes it easier for me. Thank you.
I think ‘.destructive’ style contextualAction can be swiped all the way. And ‘.normal’ style can only be swiped half way. I could be wrong.
You are correct. 👍
just amazing and informative as always
Thanks, Khaled! Glad you liked it. 😊
Excellent video. In one interview I was asked about shallow and deep copying in swift. And what is happen when Struct has Class instance variable, how this struct will be copied, shallow or deep? Could you make video about that?
Thanks, Aleksei. Have you seen Part 1 of my Swift Memory Mastery series? ua-cam.com/video/Cb1p0a6czGk/v-deo.html
This might sort it out a little for you although I don't use the words "deep and shallow" I do talk about what happens when you work with value types (structs) and reference types (classes). Check it out and let me know if it helps!
Good tutorial. Thanks!
Thanks, Ivan. Glad you enjoyed it!
Can you do a video on how to check if one of the options are clicked on?
Hi Alexander, yes, I just completed a couple videos just recently on this. Have a look:
Left Swipe to Delete: ua-cam.com/video/XcKDdNa0B_w/v-deo.html
Right Swipe to Edit: ua-cam.com/video/PLYdhGyzJwk/v-deo.html
THANKS! thats awesome
Is there a way to return the cell back to its initial position after the swipe button was tapped on?
Yeah, Alex, my other video shows you how: ua-cam.com/video/XcKDdNa0B_w/v-deo.html
Hi Mark - Terrific video!! After I tap on the button, it doesn't "pop back" into place. I was able to add tableView.reloadData() to the handler to get cell to slide back over. Now need to add some animation to make it clear that the button press worked!
Oh, that's right, Eric! Oh man I can't believe I forgot to talk about that. I even had a comment in my code for the reloadData too! Well I'm glad you figured it out, that's awesome!
supb explanation Mark!
please clarify me what is {action, view, nil} in the closure and why.
Thanks
Great video Mark. However do you know if anything changed in Xcode 12. I am unable to add both title and image to UIContextualAction. I am only able to added either one of them. Let me know at your convenience.
Hi mark , great tutorial I followed your tutorial and it works great except when i rotate device and change orientation then all the SwipeActions are wrongly placed on cell specially if you do a leading swipe and rotate your device to landscape you will notice this. Am i missing something?
Mark as always great tutorial!
Thank you, sir!
Great video Mark! One question: Is it possible to display the row swipe actions menu by clicking on the row (or a button)?
Thanks!
Thanks, Xavier! Oh man, I wish we could do that! I'd love to let the user know row actions exist by programmatically showing them when they first get to the screen. But as of now (iOS 12), there is no way. ☹️
Ohh pity! I guess we will have to wait :(
Thanks for the reply!
@@xaviwan, No problem!
It's just awesome Mark.can u please make a video for cell editing....?
Thanks, Bharat. I have a couple other videos where I take cell swiping to the next step. Including showing an alert and deleting the tableview row and swipe to edit where I open a popup to allow the person to edit:
Delete: ua-cam.com/video/XcKDdNa0B_w/v-deo.html
Edit: ua-cam.com/video/PLYdhGyzJwk/v-deo.html
@@bigmtnstudio thanx alot mark 😍😍
No problem. 😊
@@bigmtnstudio Hii mark if u don't mine can u please tell me how to get current location address .if it is possible .......?
hey Mark great video as always,
for the image colour maybe you can make the image as render as template in the assets folder and then maybe try to change the colour, I haven't tried them myself but I hope they may work.!
That's a pretty clever idea! I just went to try it but no luck. ☹️
Oh, maybe i will try something and get back ASAP
Awesome, thanks!
Another great Tutorial, thanks a lot Mark for your time and your willingness and patience to share your knowledge with others.
Can you make a Tutorial about editable text in a tableView Cell, like in a to do list app?
Thank you, sir! I can add your request to my list but to be honest, it could be a while because I'm in the middle of a big series right now. I'm 17 videos on and could be another 17 before I end. This will probably be the biggest tutorial series on UA-cam! Ha ha ha
Thank you Mark for the video. Please keep them coming 😀
Can you please make a video on localization, on making an app bilingual covering all type of UI strings in the app
Thank you, Ahmad, I'll consider it!
Please Do.
Hi Mark, do we have to be a patron to get the initial setup code you have here for this tutorial?
Yeah, Vandan, I wanted it to be a reward to people who support me and my efforts. So I saved the project just for them. Otherwise I don't really have much to exchange with them. I hope you understand!
Definitely, Mark! I completely understand. I really enjoy watching your videos. Thanks for your work.
Awww, thanks man! I'm glad you like my work! ✊🏼✊🏼
Mark, THANK YOU SO MUCH!!
If you will have time, can you please make video about UIPageViewController/UITabBarController?
Thanks, Vetaliy!
Great tutorial! Thanks, Mark.
You're welcome, Paul!
Thank you .. Great tutorial
You're welcome, Hilal!
I am trying to do same thing with SwiftUI. I found option for delete only. Is it possible with SwiftUI or not ?
stackoverflow.com/questions/60316106/how-to-create-swipeactionsconfigurationforrowat-in-list-view-swiftui-ios-13
sir can we delete a row by a custom button on table view cell ? if yes how can we do that ?
Hi Gulam, I know this was a long time ago but I have since created another video as part of another series where I go through how to do this. It's part of the Itinerary App Series: ua-cam.com/video/XcKDdNa0B_w/v-deo.html
Hope this helps answer your question!
Hi Mark, thank you very much for this video, great work! Very useful and very detailed info. Just can't change the description language coz it's locked...
Thanks, Vladimir! Let me look into locking. It might be a new control UA-cam added.
So strange, I found the checkbox to allow translations and it's checked. Maybe there's some kind of problem on UA-cam.
mark great tutorial!
I have just a question: I was wondering if there is a proper way to cancel the swipe left on a tableview cell so that it slides back to hide the buttons. for example I swipe to delete and with alert message I ask confirmation and I press button CANCEL to don't do the action, the swipe action remain visible. I tried with tableView.reloadRow at indexPath, but it reloads the cell BUT NOT THE SWIPE ACTION. I'm desperate, please I would really appreciate your help.
Thank you so much Mark..You are doing great. Sir, Will please make a tutorial about "How to load thousand of Tableview cell inside a TableView" it would help so very much.
Thanks, Mobin! What do you mean by loading thousands of cells. The tableview will handle a large amount of cells but only show as much as it can fit on the device at one time. So it loads just what it can show to save on memory. Are you running into a specific problem?
First of all Thank you so much for replying. Sir let me describe you what I was trying to know. Lets say I have an API which passes some data to the iOS application. Sometime that can be thousand of data. Which I need to display on a table view. So when i try to display thousands of data on a table view it takes like 20-30 (sometimes more) second to load up. Sometime the app crashes. Is it possible to handle those thousands of data in an efficient way? I will be very much helped sir...Every time post a new video first I check the title if its about this... :D :D :D
Mobin Al Instead of loading all 1000 records at once, try Pagination. Set a limit like 50 or so. Load 1st 50 to the datasource array. If user scrolls down and reaches the bottom, add next 50 and reload and so on.
Ohhh, I think I understand better what you're saying (after reading Bibin's comment). I thought you were saying it would take 20-30 seconds to populate the tableview but really it's taking 20-30 seconds to retrieve the data! I was confused because I was thinking once you have the data the population of the tableview is pretty quick.
Here are some videos that may get you started on the right path:
ua-cam.com/video/ty_ELVw2cSo/v-deo.html
ua-cam.com/video/hnfJlf1vs2A/v-deo.html
ua-cam.com/video/XR5KEhQCHYU/v-deo.html
how to set height of these accept or reject buttons etc according to custom container view inside cell i.e I don't want their height equal to the height of cell, I want them to be equal to the custom view inside the cell and and also how to give spaces between these buttons and corner radius to these buttons?
What's the best way to animate a 'peek' so that users know swiping actions are available?
That is a fantastic question! I have looked for a way to do this and find nothing. 😞 It is very much needed and I have submitted a feature request to Apple for it. Feel free to create a feature request too at bugreport.apple.com. We need this!
Finally, memory chapters are over. :) Thank you for showing tableview swiping operation in swift 4. No need for third party libraries now. Hey mark what are your thoughts on MVC,MVVM,VIPER and MVP project structure?
Ha ha, yes, they are over. Yeah, I'm glad we don't have to use third party libraries. They always have the risk of turning into technical debt. I really don't have too many thoughts on project structure because I've been programming for so long that I know that project structure is really just preference and nothing mandatory. It all depends on your needs, your company's standards, how much testing you want to do, how big or how small you want your project to be, how much time you want to spend at separating all responsibilities.
I view project structures like this as a scale, kind of like this:
Overly Structured Loosely Structured
If you're building a prototype then your project may be way over on the right side, loosely structured. You want development to be short just to prove a concept to a client or product owner or manager.
A large corporation might be over on the left side (overly structured) where money means nothing to them and you work on a very large team. And on this large team might be certain people that handle just one layer or part of the app. For example, one part of the team (or one person) might just handle all data transactions. They are an expert on interfacing with the data source. Everything is broken down so it can be tested and possibly even it's own project, separate from the main application project.
So basically not one pattern fits all. They are good to know about but I've made the mistake in the past of applying overly structured patterns to very simple projects to the point where rapid development was no longer was possible.
First of all great answer! Ohkkk so basically it depends on how large your project is and how that project is gonna divide to developers. So I think if your fundamentals are good for the language you are good to go. You don't need any fancy stuff :) So from now on i will put more focus on fundamentals instead of learning structures. Thanks mark for the explanation. :)
Exactly, Kishan. Also, as you work for different companies, there will most likely be an Architect that will setup the initial project structure for the devs to use.
You are right, I faced in one company in which they developed their own small swift language :)
Use the UIImage initializer that takes a renderingMode and pass in .alwaysOriginal to prevent your image from being templated. Nice video.
Thank you! I looked through the constructors for UIImage and it doesn't look like it exists anymore. I found I could do this too:
accept.image!.withRenderingMode(.alwaysOriginal)
But that didn't work. 😞
My mistake. You're right it's not the initializer but just an instance method. So they are probably preventing us from overriding this in this context. Seems a bit heavy handed. I would consider that a bug and file a radar then because there's no reason it shouldn't obey our rendering mode just because it's a swipe action.
let me clarify, only UITableView has this built-in? For UICollectionView, you still have to do it manually, correct?
Hi Alexander. Yes, UITableView has this built into iOS 11. It is not built into UICollectionView.
Any chance of a swiftUI version of this??
Unfortunately, there isn’t yet. Maybe version 2?
wow wow wow , Don't know how thank you
Thanks, Junaid! Give the video a thumbs up, that's a good way to thank me. 😀
Mark Moeykens I gave that
Thanks Mark for the video, it's so helpful to my project but I did perform the delete tableview cell , it removed the cell but the delete button is still there, it won't go away until I scroll the tableview. By the way this is what my codes look like
self.tableView.beginsupdate()
self.array.remove(at: (indexPath))
self.tableView.deleteRows(at: [indexPath], with: .fade)
self.tableView.endsupdate()
Thanks !
Mark:
Table swipe action seems to work only if the same viewcontroller is not active in a search. The search array populates the same table in the same view controller. Any suggestions to display swipe actions during for a serached table display while the search is active? Thanks, Glenn
How could you add delete confirmation to the row swipe?
Sometimes when i remove a cell from the collectionview the one next get reused and all data is messed up. How can i force to use the right data?
Do the images with the text below only work on cells that are 100+ height? Every time I try to do this on a smaller height cell it’s image only. I downloaded the project file and changed the cell height and got image only. I’ve tried this with a tiny image as well 🤔
No Jason, you should be able to supply a smaller image for cells with a shorter height and see both image and text. make sure the actual image file is smaller and not just the black part of the image is smaller.What I mean is you can have a 50x50 image border or frame and make the black image inside of it smaller and smaller while the image frame is still 50x50 inside of Sketch. So, if using Sketch for example, you want to make the artboard smaller (then scale the image to make smaller). I hope this makes sense!
Mark Moeykens I’ll triple check the image size, but it was really tiny and still wouldn’t work.
OK, let me know what happens. What is the height of your cell? Like 44 points?
Mark Moeykens cell height is 72
OK, I modified the project in the video and you're right. Here's what I found:
* Used a 30x30 image on a 72 pt high cell and no text.
* Increased cell high and found the text didn't show until cell height was 91.
* Found a bug filed that confirmed this issue: www.openradar.me/33396671
I did some more experimenting and an alternative is you can add the text to the image. This seems to work just fine.
Hi Mark.
I have a question. I am trying to build a chat app.
I am facing 2 issues with the UI.
In the chat screen, i am using a textView in inputAccessoryView for typing the chat message.
I want to adjust the height of inputAccessoryView. Is there a professional way of doing this.?
Also i am trying to build a Twitter like profile screen. It would be great to see a tutorial on how to do it.
Thanks.
Hi Bibin, I'm not sure about adjusting the height of the inputAccessoryView. I'd have to look into it more. As far as the Twitter like profile screen, you might be able to find how it's built in this series that someone else did: ua-cam.com/play/PLy9JCsy2u97kro0jXbXrPFmT-DQVAmNW0.html
Mark Moeykens Thanks Mark. Appreciate your help.
does this work with swift 5
hello sir...wheres the project video from the beginning
Hi Nishant, I don't have a video of how I created this project. I just used the project as an example to present row swiping. There is a link in the video description for the Xcode project.
If you're looking for something that shows more on building the app from the start, then you might be interested in the Itinerary App Series on my channel. I go into more detail of starting an app from nothing.
I have a situation where if a user is logged in, I want to show the leading/trailing swipes I've created, but if the user is *not* logged in, I want to display an alert ("You must log in to ..."). It works as expected for the leading swipe, but for the trailing swipe, I see the alert *BUT* I also see the Delete swipe. I can't figure out why... Any ideas?
what if I only want leading swipe, why default trailing delete shows? anyone can Help
I wonder what 'tableView(_:editActionsForRowAt:)' is for...
Ha ha, I know. I think it's mainly there for backwards compatibility now.
16:28 I was looking for a solution this to....iOS mutha....
helloMark, i have a problem ... i wanna access a particular folder form photo library... like Camera Roll, i just created a folder in photo library with name of "CBO". i wanna know that how to access this "CBO" images and display in tableview ... please help me Thankyou :)
Hi Rahul, I'm not sure how to do that. ☹️ Sorry!
ok sir no issue.. thanks bcz in whatsapp i saw thats why i'm asking ... any way no issue can you tell me how to download any file from FTP like filezila
Ha ha, not sure about FTP either. But check out Kyle's video. I'm guessing you'd use URLSession for this and he has a tutorial that covers this topic: ua-cam.com/video/8GH0yMPvQFU/v-deo.html
как всегда красавичик )))👍
Спасибо!
Messiah
Ha ha, thanks, Tushar 😃
I found the solution why when you swipe right the ACCEPT action just swipe at half the cell: it's because the style of the action is .NORMAL. if you also put the style of the action .destructive for the ACCEPT action it works perfectly. Maybe they have implemented like that, I don't know why. So the problem is not if you swipe left o right, but if the .style is .destructive or .normal
Gulam Ali
3 months ago . has a point lets see how the actions work. Half a job here. Long on cosmetics short on actual do.
Sorry about that Gabriel. I didn't think it would be a need at the time but after a couple comments I can see where it might be helpful for others. I'll make note of this for consideration of a Part 2. Right now I'm in the middle of a longer series so it may be a while.
Mark - my fault I got confused with the title "UITableView Row Swipe Actions" I thought with a title like that there would be some actions. Perhaps "UITableView Row Swipe coloured boxes" would be clearer? I am unsubscribing
Oh I gotcha. Yeah, I used the term "Swipe Actions" because of the tableview delegate method that returns the "UISwipeActionConfiguration".
Hey Gabriel, the next video in my Itinerary App Series deals with swipe actions again and in this video I have code to delete data. I actually show a confirmation alert first and then delete the data and update the tableview with the result.
I thought of you and tracked down your comment because I thought you might be interested in this as you were looking for the code of what happens after the swipe action button was tapped. Anyway, here it is and I hope it helps! ua-cam.com/video/XcKDdNa0B_w/v-deo.html
I'll try to track down Gulam Ali's comment to and let him know I have more on the subject.
Thank you Mark - appreciated and everything always helps. Cheers