SwiftUI List 프로젝트 정리하면서 다시 하기

황인성·2025년 2월 17일

iOS

목록 보기
13/24

struct List: View {
    var stringArray = ["Mary", "Joe", "James", "Mark", "Beth", "Chase", "Adam", "Rodrigo", "Notice the automatic wrapping when the text is longer", "Mary", "Joe", "James", "Mark", "Beth", "Chase", "Adam", "Rodrigo", "Notice the automatic wrapping when the text is longer"]
    
    var body: some View {
        ZStack {
            Color.blue.ignoresSafeArea()
            
            List {
                Section(header: Text("Section 1"), footer: Text("This is the footer")) {
                    ForEach(stringArray, id: \.self) { stringItem in
                        HStack {
                            Image(systemName: "person")
                            Text(stringItem)
                        }
                        .padding(.vertical)
                        .listRowBackground(Color.gray)
                    }
                }
            }
//            .listStyle(PlainListStyle())
        }
    }
}

default

.listStyle(PlainListStyle())

profile
iOS, Spring developer

0개의 댓글