diff --git a/SeungWonSU/SeungWonSU/SeungWonSUApp.swift b/SeungWonSU/SeungWonSU/SeungWonSUApp.swift index 9d680da..d07cf46 100644 --- a/SeungWonSU/SeungWonSU/SeungWonSUApp.swift +++ b/SeungWonSU/SeungWonSU/SeungWonSUApp.swift @@ -11,7 +11,7 @@ import SwiftUI struct SeungWonSUApp: App { var body: some Scene { WindowGroup { - Week2View() + week3View() } } } diff --git a/SeungWonSU/SeungWonSU/week3View.swift b/SeungWonSU/SeungWonSU/week3View.swift new file mode 100644 index 0000000..c4ffe67 --- /dev/null +++ b/SeungWonSU/SeungWonSU/week3View.swift @@ -0,0 +1,64 @@ +// +// week3View.swift +// SeungWonSU +// +// Created by 김승원 on 11/17/24. +// + +import SwiftUI + +struct week3View: View { + let data = Array(1...30).map { "Minji \($0)"} + + let columns = [ + GridItem(.flexible()), + GridItem(.flexible()), + GridItem(.flexible()) + ] + + let rows = [ + GridItem(.fixed(100)), + ] + + var body: some View { + VStack(spacing: 0) { + ScrollView { + ScrollView(.horizontal) { + LazyHGrid(rows: rows, spacing: 10) { + ForEach(data, id: \.self) { i in + VStack(spacing: 0) { + Image(.minji) + .resizable() + .scaledToFit() + .cornerRadius(15) + .frame(width: 100, height: 100) + Text(i) + } + } + } + } + + + LazyVGrid(columns: columns, spacing: 10) { + ForEach(data, id: \.self) { i in + VStack(spacing: 10) { + Image(.minji) + .resizable() + .scaledToFit() + .cornerRadius(15) + Text(i) + } + } + } + .padding(.horizontal) + } + .scrollIndicators(.hidden) + } + } + + +} + +#Preview { + week3View() +}