Skip to content

[refactor/#282] SolplyDropDown 재사용성 높이기#283

Merged
dudwntjs merged 3 commits intodevelopfrom
refactor/#282-solply-dropdown-cell
Oct 10, 2025
Merged

[refactor/#282] SolplyDropDown 재사용성 높이기#283
dudwntjs merged 3 commits intodevelopfrom
refactor/#282-solply-dropdown-cell

Conversation

@dudwntjs
Copy link
Copy Markdown
Contributor

@dudwntjs dudwntjs commented Oct 6, 2025

📄 작업 내용

  • 솔플리드롭다운을 String/아이콘+텍스트 둘다 공통으로 사용할 수 있도록 변경
구현 내용 iPhone 16 pro
애니메이션이 자연스럽다

💻 주요 코드 설명

드롭다운 사용법

SoplyDropDown(
    title: "조용한 공간에 오래 머물고 싶어요",
    options: store.state.personaOptions,
    selectedText: store.state.selectedPersona
) { chosen in
    store.dispatch(.personaSelected(chosen))
}
SoplyDropDown(
    title: "장소 유형을 선택해주세요",
    tagOptions: Array(MainTagType.allCases.dropFirst())
)
  • 위에는 MVI패턴 적용해서 해둔 String 옵션만 있는 경우구요!
  • 아래는 아이콘+텍스트 일 때 사용하는 건데 MainTagType을 바로 데려올 수 있어서 저렇게 쓰면 됩니다!
  • dropFirst())쓴 이유는 제일 처음 '전체'는 빠지길래 앞부분 빼는 거 넣었어여

애니메이션

var header: some View {
        Button {
            withAnimation(.easeInOut(duration: 0.2)) {
                isExpanded.toggle()
            }
        } label: {
  • withAnimation 안에 어떤 효과 넣을 건지 적어야한다잉...
  • 애니메 공부도 하고싶네여

🔗 연결된 이슈

📚 제가 이거하면서 한 삽질

옵션이 String일 때도 있고, 아이콘+텍스트일 때도 있으나깐!! 타입에 구애받지 않도록
제네릭을 쓰려고 했다가 망한 이야기... 노션 트슈에 적어놧슴ㄴ디ㅏ 많관부

제네릭을 쓰고 시펏는데 못써요

@dudwntjs dudwntjs requested a review from a team October 6, 2025 07:51
@dudwntjs dudwntjs self-assigned this Oct 6, 2025
@dudwntjs dudwntjs added ☀️ youngju 영주가함! 🧤 refactor 기존 코드를 리팩토링하거나 수정할 시 사용 labels Oct 6, 2025
@dudwntjs dudwntjs linked an issue Oct 6, 2025 that may be closed by this pull request
1 task
@dudwntjs dudwntjs changed the title [refactor/#282] SolployDropDown 재사용성 높이기 [refactor/#282] SolpolyDropDown 재사용성 높이기 Oct 6, 2025
@dudwntjs dudwntjs changed the title [refactor/#282] SolpolyDropDown 재사용성 높이기 [refactor/#282] SolplyDropDown 재사용성 높이기 Oct 6, 2025
Copy link
Copy Markdown
Collaborator

@SeungWon1125 SeungWon1125 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정사항만 반영해주쇼~!

Comment on lines +48 to +63
init(
title: String,
options: [String],
selectedText: String? = nil,
onSelect: ((String) -> Void)? = nil
) {
self.title = title
self.selectedText = selectedText
self.onSelectText = onSelect
self.selectedTag = nil
self.onSelectTag = nil

var seen = Set<String>()
let merged = ([title] + options).filter { seen.insert($0).inserted }
self.options = merged.map { .text($0) }
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

개행 제대로!

Rectangle()
.fill(Color(.gray200))
.frame(height: 52.adjustedHeight)
.cornerRadius(16.adjustedHeight, corners: [.topLeft, .topRight])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cornerRadius 에 기기대응 안 해도 될듯! 다른 것도 수정해 주세요

Copy link
Copy Markdown
Contributor

@pedro0527 pedro0527 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정해수정해수정해

options: [String],
selectedText: String? = nil,
onSelect: ((String) -> Void)? = nil
) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이상해이상해이상해

.lineLimit(1)
.truncationMode(.tail)

Spacer(minLength: 0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우하하 처음봄 이거
근데 언제 써야하나여 이건 0으로 줄꺼면...?

@dudwntjs dudwntjs requested review from a team, SeungWon1125 and pedro0527 and removed request for SeungWon1125 and pedro0527 October 10, 2025 17:53
Copy link
Copy Markdown
Collaborator

@SeungWon1125 SeungWon1125 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿!!

Copy link
Copy Markdown
Contributor

@pedro0527 pedro0527 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿

@dudwntjs dudwntjs merged commit be31217 into develop Oct 10, 2025
@dudwntjs dudwntjs deleted the refactor/#282-solply-dropdown-cell branch October 10, 2025 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧤 refactor 기존 코드를 리팩토링하거나 수정할 시 사용 ☀️ youngju 영주가함!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] SolplyDropDown 리팩토링

3 participants