-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from SOPT-all/feat/31-week3
[3주차] 김승원 실습
- Loading branch information
Showing
2 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ import SwiftUI | |
struct SeungWonSUApp: App { | ||
var body: some Scene { | ||
WindowGroup { | ||
Week2View() | ||
week3View() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} |