Skip to content

Commit

Permalink
♻️ :: [#36] MainView / Image 형식 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
shwaaaa committed Dec 30, 2024
1 parent 015b1a5 commit c22c911
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions Projects/App/Sources/Feature/MainFeature/Sources/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import SwiftUI
struct MainView: View {
@StateObject var viewModel = MainViewModel()
@StateObject var postViewModel: PostViewModel
@State private var selectedIndex = 0

var body: some View {
NavigationView {
Expand Down Expand Up @@ -166,38 +167,38 @@ struct MainView: View {
.foregroundStyle(GPleAsset.Color.gray800.swiftUIColor)
.font(GPleFontFamily.Pretendard.regular.swiftUIFont(size: 14))
}
.padding(.leading, 8)

Text(title)
.foregroundStyle(GPleAsset.Color.white.swiftUIColor)
.font(GPleFontFamily.Pretendard.semiBold.swiftUIFont(size: 18))
.padding(.top, 16)
.padding(.leading, 8)

Text(place)
.foregroundStyle(GPleAsset.Color.gray600.swiftUIColor)
.font(GPleFontFamily.Pretendard.regular.swiftUIFont(size: 14))
.padding(.top, 4)

ForEach(imageURL, id: \.self) { imageURL in
AsyncImage(url: URL(string: imageURL)) { phase in
switch phase {
case .empty:
ProgressView()
.frame(width: 318, height: 318)
case .success(let image):
image
.resizable()
.scaledToFit()
.frame(width: 318)
.cornerRadius(8)
case .failure:
Image(systemName: "exclamationmark.triangle.fill")
.foregroundColor(.red)
.frame(width: 318, height: 318)
@unknown default:
EmptyView()
.padding(.leading, 8)

TabView(selection: $selectedIndex) {
ForEach(imageURL.indices, id: \.self) { index in
if let imageUrl = URL(string: imageURL[index]) {
AsyncImage(url: imageUrl) { image in
image
.resizable()
.padding(.top, 12)
} placeholder: {
ProgressView()
.progressViewStyle(CircularProgressViewStyle())
}
.tag(index)
}
}
}
.padding(.horizontal, 8)
.frame(height: 381)
.tabViewStyle(.page)
.padding(.top, 16)

HStack(spacing: 8) {
Expand All @@ -212,6 +213,7 @@ struct MainView: View {
.foregroundStyle(GPleAsset.Color.gray600.swiftUIColor)
.font(GPleFontFamily.Pretendard.regular.swiftUIFont(size: 14))
.padding(.top, 12)
.padding(.leading, 8)

let dateString = date.split(separator: "T").first
if let dateString = dateString {
Expand All @@ -224,13 +226,15 @@ struct MainView: View {
.foregroundStyle(GPleAsset.Color.gray800.swiftUIColor)
.font(GPleFontFamily.Pretendard.regular.swiftUIFont(size: 14))
.padding(.top, 6)
.padding(.leading, 8)
}
}

}
.padding(.horizontal, 10)
.padding(.vertical, 20)
.padding(.horizontal, 16)
.background(GPleAsset.Color.gray1000.swiftUIColor)
.cornerRadius(12)
.padding(.horizontal, 20)
}
}

0 comments on commit c22c911

Please sign in to comment.