Skip to content
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

목표 삭제 기능 구현 #111

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from
Open

목표 삭제 기능 구현 #111

wants to merge 15 commits into from

Conversation

junu0516
Copy link
Collaborator

close #108

  • 원래는 셀을 오른쪽에서 왼쪽으로 Swipe 하는 식으로 구현하려 했는데, 아래와 같은 이유로 따로 액션 시트를 보여주는 UI를 추가한 후, 여기서 사용자가 삭제 여부를 선택할 있도록 구현했어요
    (좀 보기 이상한 UI다 싶으면 같이 얘기해보고 기능 유지한채로 디자인만 다시 수정하면 될듯합니다!)
    • Compositional Layout 내부에서 UISwipeAction을 추가할 경우에는, 이 때 사용하는 타입이 iOS14 이상에서만 사용 가능
    • UIContextualAction 과 같은 경우에는 보통 테이블뷰의 delegate method 안에서 사용하거나, 컬렉션뷰에 적용한다 하더라도 비슷하게 delegate method를 사용해야 함
    • 이럴 경우 (우선 여러가지 시도해본바로는) 코드가 너무 복잡해질 뿐더러, 무엇보다 부가 메뉴가 존재함을 알 수 있는 UI 요소가 없으면 사용자 입장에서 Swipe Action을 통해 무언가를 할 수 있다는 사실을 알기 어렵겠다고 생각
    • 결국 위와 같은 이유로 액션 시트를 보여주는 UI 요소를 우선 구현하고, 이를 터치했을 때 화면에 삭제 여부를 선택할 수 있는 액션 시트를 보여주도록 함

Simulator Screen Recording - iPhone 12 mini - 2022-11-27 at 23 19 28

@junu0516 junu0516 self-assigned this Nov 27, 2022
@junu0516 junu0516 linked an issue Nov 27, 2022 that may be closed by this pull request
3 tasks
@junu0516 junu0516 requested a review from Hansolkkim November 28, 2022 04:55
Copy link
Collaborator

@Hansolkkim Hansolkkim left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!
스와이프해서 메뉴를 보여주는게 iOS14부터 되는 기능이었군요..ㅎㅎ 배워갑니다
회의를 한다고 생각하면, 저는 꾹 눌렀을 때 AlertMenu가 나오는것도 한 번 제안해봤을것 같아요!

이번에도 질문과 제안 위주로 코멘트 달았습니다ㅎㅎ
천천히 확인해주시고 답변부탁드려요!

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

viewModel?.requestGoalList.accept(())
Copy link
Collaborator

@Hansolkkim Hansolkkim Nov 28, 2022

Choose a reason for hiding this comment

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

제드 이거 GoalDetailVC에서 사진을 찍고 GoalListVC로 돌아왔을 때 Goal.progress가 화면에 반영이 안돼서 viewWillAppear에 위치시켰었는데, 혹시 이렇게 제거하면 해당 문제없었나요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

다시 확인해볼께요 ㅋㅋ 우선은 뷰모델 관련 로직 한군데로 몰아넣어보려고 이동했던거였어요!


viewModel.requestGoalList.accept(())

viewModel.showActionSheetMenu
Copy link
Collaborator

@Hansolkkim Hansolkkim Nov 28, 2022

Choose a reason for hiding this comment

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

저 저번에 "공유기능" 만들 때 이런 부분에 대해서 고민해본적이 있었는데, UIViewController.present(_:_:) 메소드(화면이동) 사용이 필요한 부분이라 VC에서 할지, Coordinator에서 할지 결정하기 쉽지 않더라구요ㅋㅋ 제드는 혹시 어떻게 생각하셨나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

음.. 독립적인 화면으로 관리할꺼면 코디네이터로 가는게 맞고,
모든 상황에서 컬렉션 뷰 셀같이 하위 화면으로 종속되는거면 뷰컨트롤러에 있어도 괜찮겠다고 생각했어요.

액션 시트같은 경우에는 별도의 뷰컨트롤러는 아니어서 그냥 저렇게 안에 넣어놨습니다 ㅋㅋ

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Hansolkkim
이거 주말동안 다시 한 번 생각해봤는데,
모든 Alert 포함 화면에 present하는 책임을 Coordinator에 주고 싶으면

  • Alert 보여주는 디폴트 메소드를 가진 프로토콜 하나 선언
  • NavigationController을 가진 Coordinator이 해당 프로토콜 채택 후, 필요할 때마다 NavigationController 위에서 Alert 보여주는 디폴트 메소드 호출

이런식으로도 개선 가능하겠네요..!
(테스트해보고 커밋 올려볼께요!)

rabit/rabit/Goal/Views/GoalListCollectionViewCell.swift Outdated Show resolved Hide resolved
Comment on lines +117 to +119
make.top.equalToSuperview()
make.bottom.equalTo(titleStackView.snp.top)
make.trailing.equalToSuperview().inset(20/376 * UIScreen.main.bounds.width)
Copy link
Collaborator

@Hansolkkim Hansolkkim Nov 28, 2022

Choose a reason for hiding this comment

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

레이아웃 관련 제안이라 조금 애매하지만, menuButton의 위치가 뭔가 위에만 붙어있는 느낌이라, Top, Trailing Margin이 일치하면 더 보기 좋을 것 같다는 생각이 들었어요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

듣고보니 위에도 간격주는게 더 보기 좋겠네요 ㅎㅎ 이것도 수정할께요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

top margin 이 없을 때

image

top margin 이 trailing margin과 동일할 때

image

이런식으로 버튼의 레이아웃이 다르게 나타납니다. 처음에는 제안해주신대로 top margin에 값을 부여하면 기존과 높이는 유지된채로 셀의 top에서부터 약간 떨어진 정도가 되겠구나 생각했는데, 해놓고보니 위처럼 나타나더라구요. bottom anchor은 유지한 상태에서, top margin값만 부여하다보니 자동으로 높이가 조정되서 저렇게 보인 것 같습니다.

SF Symbol에서 제공하는 기본 아이콘을 우선 가져온 상황에서, 이미지를 감싸는 배경이 되는 버튼의 높이를 넉넉하게 잡으려고 셀의 top과 셀 내부의 titleStackView의 top의 사이 간격 전체를 차지하도록 저렇게 높이를 잡았었는데(이미지의 크기는 버튼 높이와 무관하게 동일합니다.), 우선은 이 부분은 기존대로 두는게 괜찮을 것 같습니다! top margin이 들어가면 버튼의 높이가 줄어들어서 아무래도 사용자가 메뉴를 보기 위해 터치해야 할 영역이 너무 작아지는 것 같아서요

조만간 이 부분도 디자인 바뀌거나 다른 아이콘을 넣기로 합의하게 되면 그 때 디자인 맞춰서 레이아웃 다시 조정하면 될 것 같습니다 ㅎㅎ

rabit/rabit/Goal/Views/GoalListCollectionViewCell.swift Outdated Show resolved Hide resolved
Comment on lines 67 to 69
.flatMapLatest { viewModel, goal in
viewModel.repository.deleteGoal(goal: goal)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

deleteGoal에 대한 바인딩 2번을 한 번에 하기 보다는, result에 대한 바인딛 1번, 그리고 result의 결과에 대한 바인딩 1번, 이렇게 2번으로 나누어서 바인딩 로직을 짜는건 어떨까요?

let deleteResult = deleteGoal
    .withUnretained(self)
    .flatMapLatest { viewModel, goal in
        viewModel.repository.deleteGoal(goal: goal)
    }
    .disposed(by: disposeBag)

deleteResult
    .withUnretained(self)
    .bind {
        ...
    }
    .disposed(by: disposeBag)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

제안해주신대로 수정했습니다 ㅎㅎ 훨씬 직관적이네요

rabit/rabit/Goal/GoalListRepository.swift Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

목표 삭제 기능 적용
2 participants