Skip to content

[Style/#19] 아티스트 멤버 섹션뷰 / 내 활동 섹션뷰 구현#35

Open
sssthnnhee wants to merge 14 commits into
mainfrom
Style/#19
Open

[Style/#19] 아티스트 멤버 섹션뷰 / 내 활동 섹션뷰 구현#35
sssthnnhee wants to merge 14 commits into
mainfrom
Style/#19

Conversation

@sssthnnhee
Copy link
Copy Markdown
Collaborator

@sssthnnhee sssthnnhee commented May 13, 2026

🍈 작업 내용

  • 아티스트 탭 內 아티스트 멤버 섹션 뷰 구현
    ( 기존에 작업해둔 헤더 컴포넌트와 컬렉션 뷰 사용 )
  • 팬 활동 탭 內 내 활동 섹션 뷰 구현
    ( 이번에 새로 필요한 컬렉션 뷰 및 컴포넌트 구현 )

🍈 주요 코드 설명

🍉 라벨 내 색상 지정

MyActivitySectionView

    
    private func setInfoLabel() {
        let name = "김렛솝"
        let text = "\(name)님은 3개의 카드를 가지고 있어요."
        let coloredText = NSMutableAttributedString(string: text)
        let range = (text as NSString).range(of: name)
        coloredText.addAttribute(.foregroundColor, value: UIColor.green02, range: range)
        myCardInfoLabel.attributedText = coloredText
    }
    
    private func setMyCardInfo(){
        setInfoLabel()
    }
    
  • 위와 같이 setInfoLabel 함수를 작성하여 하나의 라벨 내에서 색을 다르게 지정하였습니다
  • 그리고 위 함수를 setMyCardInfo 라는 함수에서 호출하도록 하였는데, 이 부분에 대해 고민중입니다 (PR 맨 아래 참조 ... + 코드리뷰를 기다림)

그리고 새로 추가한 폴더와 파일이 여러 개 있어서..
폴더구조 설명 간단하게 드리고 싶습니다

🍉 목표하는 폴더 구조

image

우선 위와 같은 구조로 파일을 작성해보았고, 제가 희망하는 최종 파일구조는 아래와 같습니다

image

active 뷰 내의 3개의 탭을 각각 폴더로 두고, 완성된 섹션 뷰를 바로 밑에 위치시키면 좋을것같습니다
추가로 만들어둔 파일들은 잘 묶어서 폴더링하여 각 탭의 폴더 바로 아래에는 각 탭 별로 2개씩 존재하는 완성된 섹션뷰만 있도록

(*위 빈 파일들은 로컬 테스트용 브랜치에 만들어본것이니 안심하십시오 지금 푸시해두지않앗습니다)

🍉 섹션 뷰 사용 시 유의점

$0.top.leading.trailing.equalToSuperview()           

당연히 알고계시겠지만 꼭 제약조건을 설정해주십시오...

bottom은 사용하는 뷰컨트롤러에서 상황에 맞게 설정해주시면 됩니다

🍈 구현화면

ArtistMemberSectionView MyActivitySectionView

🍈 연결된 이슈

🍈 기타 더 이야기해볼 점

MyActivitySectionView 파일에서

    override func setUI() {
        addSubviews(myActivityHeader,
                    myCardInfoView,
                    myCardCollectionView,
                    likeList,
                    commentList)
        
        myCardInfoView.addSubviews(myCardInfoLabel,myCardChevron)
    }

setUI() 안에 둔
myCardInfoView.addSubviews(myCardInfoLabel,myCardChevron)
이 코드를 setMyCardInfo에 넣었었는데, addSubviews 는 여태까지 전부 setUI 에 넣어왔다는 것을 깨닫고 다시 setUI로 옮겼습니다

그래서 사실상 setMyCardInfo는 함수 하나만 호출하는거라 의미가 없는 것같고..
setMyCardInfo를 setStyle 에서 부르고있어요

그냥 setStyle 내에서 바로 setInfoLabel 해주는게 나을까 라는 고민입니다

@sssthnnhee sssthnnhee linked an issue May 13, 2026 that may be closed by this pull request
3 tasks
@sssthnnhee sssthnnhee self-assigned this May 13, 2026
@sssthnnhee sssthnnhee changed the title Style/#19 [Style/#19] 아티스트 멤버 섹션뷰 / 내 활동 섹션뷰 구현 May 13, 2026
Copy link
Copy Markdown
Collaborator

@dearosmar dearosmar left a comment

Choose a reason for hiding this comment

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

전체적으로 코드의 순서에 대한 공통적인 고민이 조금 필요해 보여요! 프로퍼티 - 초기화 - 오버라이드 - 추가 함수 이런 식으로 구현해 보시는 건 어떠신가요? 그리고 코드를 공통적인 방식으로 구현해 보시면 익숙해지면서 편해지실 것 같습니다! 새벽까지 너무 고생하셨습니다

Comment thread Melon-iOS/Melon-iOS/Presentation/Active/ArtistTab/ArtistMemberSectionView.swift Outdated
Comment thread Melon-iOS/Melon-iOS/Presentation/Active/FanTab/MyActivitySectionView.swift Outdated
@sssthnnhee sssthnnhee requested a review from dearosmar May 14, 2026 02:54
Copy link
Copy Markdown
Collaborator

@sangyup12 sangyup12 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 컬뷰 잘하시는데 컴포지셔널도 해보심이 어떨지 ㅎㅎ .아쉽게도 더이상 구현할 컬뷰가 없네요. 폴더 구조까지 생각해주시다니 정말 훌륭합니다. setInfoLabel은 말씀해주신대로 setStyle에서 바로 호출해주시면 될 거 같습니다 !
마크 주석 위아래 한칸씩 띄워주는 것만 신경써주시면 좋을 거 같아요 !!

private let artistLabelKr = UILabel()

private let artistLabelEn = UILabel()
//MARK: - Initializer
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.

마크 주석은 위에도 한 칸 띄워서 써줍시다 ~

Copy link
Copy Markdown
Collaborator

@dearosmar dearosmar left a comment

Choose a reason for hiding this comment

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

정말 고생하셨습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Style] 아티스트 멤버 섹션 및 팬 활동 탭 내 활동 뷰 구현

3 participants