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

[setting] 프로젝트 세팅 #90

Merged
merged 6 commits into from
Jul 1, 2024
Merged

Conversation

JinUng41
Copy link
Contributor

🔗 연결된 이슈

📄 작업 내용

  • Extension 및 Util 코드 추가
  • 폴더링 (Application / Source / Resource)
  • 컬러 에셋 추가 (white, black 제외)
  • 폰트 추가 (Pretendard-1.3.9)
구현 내용 IPhone 15 pro
폰트 자간, 행간

💻 주요 코드 설명

Label의 텍스트 일부 하이라이팅

  • 와이어프레임 상, 위와 같은 경우에 대비하기 위해 텍스트 중 일부를 하이라이팅 하는 코드를 구현하였습니다.
  • setText로 먼저 레이블의 텍스트를 지정한 뒤
  • setHighlightedText를 이용하여, 하이라이팅하고 싶은 텍스트를 지정하는 순으로 구현해야 합니다.
UILabel+.swift
extension UILabel {
    func setText(_ text: String, style: UIFont.Pretendard, color: UIColor) {
        attributedText = .pretendardString(text, style: style)
        textColor = color
        numberOfLines = 0
    }
    
    func setHighlightText(_ words: String..., style: UIFont.Pretendard, color: UIColor? = nil) {
        guard let currentText = attributedText?.string else { return }
        let mutableAttributedString = NSMutableAttributedString(
            attributedString: attributedText ?? NSAttributedString()
        )
        let textColor = textColor ?? .black
        
        for word in words {
            let range = (currentText as NSString).range(of: word)
            
            if range.location != NSNotFound {
                let highlightedAttributes: [NSAttributedString.Key: Any] = [
                    .font: UIFont.pretendard(style),
                    .foregroundColor: color ?? textColor
                ]
                mutableAttributedString.addAttributes(highlightedAttributes, range: range)
                attributedText = mutableAttributedString
            }
        }
    }
}

👀 기타 더 이야기해볼 점

  • Git Flow Rule에 맞추어, suyeon 브랜치를 만들고, 지금 브랜치는 suyeon에 merge 할 것입니다.
  • 행간을 구현하기는 했는데, 와프와 완전히 똑같지 않아서 수정해야 할 것 같은데 어떡하면 좋을까요?

- Application, Source, Resource으로만 나눔.
- 스타일 가이드에 gray8 다음에 바로 gray10이 나오던데, 이를 gray9로 적용
- orange3의 경우, 안내하는 코드와 실제 색상 코드가 다른데 우선 `#F36E39`로 적용
@JinUng41 JinUng41 added ⚙️ setting 프로젝트 관련 설정 변경 시 사용 🧀 add 사진 등 에셋이나 라이브러리 추가 시 사용 💙 JinUng 걸스 토크에 미쳐보고 싶다면 labels Jun 30, 2024
@JinUng41 JinUng41 self-assigned this Jun 30, 2024
- `#F36E39` -> `#FF8B4A`
@hooni0918
Copy link
Member

와우 역시 킹진웅!
혹시 와프와 동일하게 구현하려면 얼마나 더 걸릴까요? 1일내에 수정이 가능하면 수정후 올려도 될것같다 생각합니다

Copy link
Member

@youz2me youz2me left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 와프와 똑같지 않다는게 정확히 어떤 뜻인지 이해를 못했는데 수치는 같은데 뭔가 보이는게 다른건지 아니면 수치가 다른건지 궁금합니다 ~~!
전자면 실기기로 보면서 세부 조정하고 후자면 수치만 변경하면 좋을 것 같네용 ㅎㅎ

@mmaybei
Copy link
Member

mmaybei commented Jul 1, 2024

텍스트 하이라이팅까지.. 진짜 extension 쌈뽕하네요.. 수고하셨습니다!

@JinUng41 JinUng41 merged commit 06216cf into suyeon Jul 1, 2024
1 check passed
@JinUng41 JinUng41 deleted the setting/#89-project-setting branch July 1, 2024 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧀 add 사진 등 에셋이나 라이브러리 추가 시 사용 💙 JinUng 걸스 토크에 미쳐보고 싶다면 ⚙️ setting 프로젝트 관련 설정 변경 시 사용
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants