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

디자인시스템 모듈화 및 font 메서드 수정 #8

Merged
merged 7 commits into from
Jan 27, 2024

Conversation

WhiteHyun
Copy link
Member

@WhiteHyun WhiteHyun commented Jan 26, 2024

Screenshots 📸

Dependency
image



고민, 과정, 근거 💬

DesignSystem 모듈화

App Target 내부에 있던 DesignSystem을 외부 패키지로 분리했습니다.
각 화면마다 데모앱을 실행할 때 DesignSystem을 일일히 구현하는 것을 방지하기 위함입니다.
대신, App Target에 Font를 설정했을 때는 Info.plist로 설정하기만 하면 됐으나, 폰트파일이 외부패키지로 이동하게 되면서 Info.plist 대신 다른 방법을 찾아야 했습니다.
그래서 커스텀 폰트를 패키지에 설정하는 법[1]이라는 블로그 글을 참고하여 적용했습니다.
테스트 결과 정상작동합니다!

textStyle(_:)에서 font(_:)로 수정

SwiftUI에서 사용하는 font 메서드를 그대로 overloading할 수 있도록 설정했습니다.

BeforeAfter
struct TestView: View {
  var body: some View {
    Text("Hello, World!")
      .textStyle(.b1)
  }
}
struct TestView: View {
  var body: some View {
    Text("Hello, World!")
      .font(.b1)
  }
}

References 📋

  1. Packaging your Custom Fonts in Swift Packages




@WhiteHyun WhiteHyun added the 🔧 Enhancement Improvement or Feedback Implementation label Jan 26, 2024
@WhiteHyun WhiteHyun added this to the v2.0.0 milestone Jan 26, 2024
@WhiteHyun WhiteHyun requested a review from a team January 26, 2024 09:24
@WhiteHyun WhiteHyun self-assigned this Jan 26, 2024
Copy link
Contributor

@eung7 eung7 left a comment

Choose a reason for hiding this comment

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

👍 고생하셨습니다!

@WhiteHyun WhiteHyun merged commit f9da01a into main Jan 27, 2024
2 checks passed
@WhiteHyun WhiteHyun deleted the feature/designsystem/7 branch January 28, 2024 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔧 Enhancement Improvement or Feedback Implementation
Projects
Development

Successfully merging this pull request may close these issues.

DesignSystem 모듈화
2 participants