-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 검색 화면 정리 및 검색 상세 화면 구현 #46
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,14 @@ import SwiftUI | |
import PPACModels | ||
|
||
public struct MemeListView: View { | ||
private let memeDetailList: [MemeDetail] | ||
private let columns = Array(repeating: GridItem(.flexible(), | ||
spacing: 12, | ||
alignment: .center),count: 2) | ||
@Binding var memeDetailList: [MemeDetail] | ||
private let columns = Array( | ||
repeating: GridItem( | ||
.flexible(), | ||
spacing: 12, | ||
alignment: .center | ||
), count: 2 | ||
) | ||
private let memeClickHandler: ((MemeDetail) -> ())? | ||
private let memeCopyHandler: ((MemeDetail) -> ())? | ||
private let onAppearLastMemeHandler: (() -> ())? | ||
|
@@ -22,12 +26,12 @@ public struct MemeListView: View { | |
} | ||
|
||
public init( | ||
memeDetailList: [MemeDetail], | ||
memeDetailList: Binding<[MemeDetail]>, | ||
memeClickHandler: ((MemeDetail) -> ())? = nil, | ||
memeCopyHandler: ((MemeDetail) -> ())? = nil, | ||
onAppearLastMemeHandler: (() -> ())? = nil | ||
) { | ||
self.memeDetailList = memeDetailList | ||
self._memeDetailList = memeDetailList | ||
self.memeClickHandler = memeClickHandler | ||
self.memeCopyHandler = memeCopyHandler | ||
self.onAppearLastMemeHandler = onAppearLastMemeHandler | ||
|
@@ -45,7 +49,6 @@ public struct MemeListView: View { | |
} | ||
} | ||
|
||
|
||
public var body: some View { | ||
ScrollView { | ||
HStack(alignment: .top) { | ||
|
@@ -96,11 +99,11 @@ public struct MemeListView: View { | |
|
||
"https://images.unsplash.com/photo-1507146426996-ef05306b995a?q=80&w=3540&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" ] | ||
|
||
let memeDetailList = (0..<20) | ||
@State var memeDetailList = (0..<20) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 20개로 한정된 이유가 있나요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hryeong66 요거 그냥 테스트용으로 두신거죠?_? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵 요거는 테스트로 추가한거라 개수는 임의로 넣었습니답!
lina0322 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.map { MemeDetail(id: "\($0)", title: MemeDetail.mock.title, | ||
keywords: MemeDetail.mock.keywords, | ||
imageUrlString: mockImageList[$0 % 4], | ||
source: MemeDetail.mock.source, | ||
isTodayMeme: true, reaction: $0 % 4, isFarmemed: true) } | ||
return MemeListView(memeDetailList: memeDetailList) | ||
return MemeListView(memeDetailList: $memeDetailList) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// SearchKeywordUseCase.swift | ||
// PPACDomain | ||
// | ||
// Created by 리나 on 7/18/24. | ||
// | ||
|
||
import Foundation | ||
|
||
import PPACModels | ||
|
||
public protocol SearchKeywordUseCase { | ||
func execute(keyword: String) async throws -> [MemeDetail] | ||
} | ||
|
||
public class SearchKeywordUseCaseImpl: SearchKeywordUseCase { | ||
private let repository: MemeRepository | ||
|
||
public init(repository: MemeRepository) { | ||
self.repository = repository | ||
} | ||
|
||
public func execute(keyword: String) async throws -> [MemeDetail] { | ||
try await repository.getSearchKeywordMemeList(keyword: keyword) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// HotKeywordsUseCase.swift | ||
// PPACDomain | ||
// | ||
// Created by 리나 on 7/18/24. | ||
// | ||
|
||
import Foundation | ||
|
||
import PPACModels | ||
|
||
public protocol HotKeywordsUseCase { | ||
func execute() async throws -> [HotKeyword] | ||
} | ||
|
||
public class HotKeywordsUseCaseImpl: HotKeywordsUseCase { | ||
private let repository: KeywordRepository | ||
|
||
public init(repository: KeywordRepository) { | ||
self.repository = repository | ||
} | ||
|
||
public func execute() async throws -> [HotKeyword] { | ||
try await repository.getHotKeywords() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// MemeCategorysUseCase.swift | ||
// PPACDomain | ||
// | ||
// Created by 리나 on 7/18/24. | ||
// | ||
|
||
import Foundation | ||
|
||
import PPACModels | ||
|
||
public protocol MemeCategorysUseCase { | ||
func execute() async throws -> [MemeCategory] | ||
} | ||
|
||
public class MemeCategorysUseCaseImpl: MemeCategorysUseCase { | ||
private let repository: KeywordRepository | ||
|
||
public init(repository: KeywordRepository) { | ||
self.repository = repository | ||
} | ||
|
||
public func execute() async throws -> [MemeCategory] { | ||
try await repository.getMemeCategorys() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요거 gridItem으로 하고 grid 사용하면 두 column 사이에 공백이 생길텐데 그 부분은 추후에 처리하실 예정이실까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hryeong66 확인 부탁드려횹🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hryeong66 확인 부탁드려횹🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앟 요거 grid로 하면 한 row 의 높이가 높은 쪽에 맞춰져서 디자인 요구사항을 맞출 수 없어
LazyVStack 두개를 HStack으로 넣는걸로 수정했습니다!
그래서 요 column 안쓰는데 삭제가 안되었네여.. 다음 PR 때 같이 삭제해서 올릴게요~!