Add, edit, move, and delete items in a List in SwiftUI | Bootcamp #31

preview_player
Показать описание
In this video we will dive into the List component in SwiftUI. The List has built-in features that allow us to easily edit, move, add, and/or delete items from our data array. As you'll see, the list makes it incredibly simple to add a swipe-to-delete feature to our iOS application! We will also look into the different ways that we can customize the List with .listStyle().

🤙 WELCOME BACK 🤙

Рекомендации по теме
Комментарии
Автор

And for the NavigationBarItems that are now deprecated, we should be using toolbar:
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
EditButton()
}
ToolbarItem(placement: .navigationBarTrailing) {
addButton
}
}

shost
Автор

iOS 17.5
To get the sections to collapse you have declare a Boolean variable (e.g.

@State var isExpanded:Bool=true

)
, and then add an initializer of isExpanded to the Section(e.g.

Section(isExpanded: $isExpanded) then all the other stuff

). Bind the initializer to your Boolean and add the .listStyle(.sidebar) modifier to your List. Chevron is back!

mattrutkowski
Автор

As I want to mention, on the latest version of Xcode. We should add a () after the style, for example : .listStyle(GroupedListStyle) should be change to . Others listStyle as well.

Jimmy-jtip
Автор

Never knew about eliminating those variables in the move and delete calls. Very clean! Many new things here and I have used lists (and fought formatting them) in so many projects! Thanks Nick!

KimbrellBrad
Автор

I suggest to show at the beginning what you will demonstrate in video demo, it would be amazing .

tariqAlmazyad
Автор

Nick,
THANKYOU, Another very nice lesson, very very useful,
#1 Section header does not show the Shevron icon, or even the color is not blue, may be new iOS the attributes are different?
(I tried iPhone, iPad etc, no luck), may be something I am doing wrong !
>>
Section(
header: Text("Fruits")) {
ForEach(fruits, id: \.self) {fruit in
Text(fruit.capitalized)
}
#2 also the styles does not change ... for example
>>

stelluspereira
Автор

Thank you - just brilliant and has helped me even more than CodingWithChris, which is a little disloyal, but he didn't get me where I needed to be for my current project challenge

pazuzutru-truluv
Автор

tip regarding embedding in a view which is not in the suggestion list: choose the "Embed..." option which will automatically allow you to type the view in which you want to embed something.

sergiuprodan
Автор

You content is very good; if not excellent. Keep up the good work; looking forward to seeing more. However a small point...indices, plural of index, are not pronounced "in dices". They are pronounced(phonetically).... "in dih seas". Many words that end in "x" are similar...such as matrix.

kenturnbull
Автор

A very very helpful tutorial, I am getting trough all tutorial videos, your SwiftUI Bootcamp is totally helpful!! Thank you for posting.

RoshniParekh-hx
Автор

Thanks for the great content, Nick. Learning a lot from your vids. I have the below questions:

1. swiftUI is not giving the collapsable list by default anymore. Looks like there is an extra step I have to take but not sure what it is.

2. Most important one. I have the code correct. I am able to add, edit and stuff. The only thing, when I move/reorder items in the list, they resist and get back to their own place. Any thoughts on that one?

Thanks a lot in advance.

Baxishoff
Автор

Amazing video, just what the doctor ordered

jonas
Автор

Nick thanks for this fantastic video, your knowledge is pretty valuable for me, keep it for me.

julianm
Автор

Hi, Nick this video is great, I just wanted to thank you, you're the best!!

hashemakkad
Автор

Thank you for delivering so nice tutorials!

airinfinite
Автор

Thank you nick, your explanation is very useful for me

magedmohmed
Автор

Nice Tutorial! Very helpful. Gave me lots of new things to try out.

beemercycle
Автор

Thank you, very helpful greetings from Austria

thomasuchatzi
Автор

Thank you so much for this great content

coffeeCatPeanutDust
Автор

Thank you! It was very helpful for me!!

AlexF