Conversation
- FontRegistrar 열거형 추가 - registerFonts() 메서드로 Pretendard 폰트 일괄 등록 - registerFont() 메서드로 개별 폰트 동적 등록
|
font size는 기본값을 제공하고, 특별한 경우 변화가 필요할 때 사용할 수 있는 모디파이어를 추가하는건 어떨까요? 🤔 |
Contributor
Author
pretendard와 caption1을 제외하고는 전부 라이브러리에 맞게 모든 사이즈들이 등록되어있습니다!(링크 참고) |
jeongju9216
approved these changes
Sep 3, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Figma Library에 맞게 폰트를 구현했습니다.
사용법
SwiftUI에 제공되는 font 메서드와 동일하게 가져갔습니다.
(새로운 modifier보다 익숙하고 명확한 font 메서드가 낫다고 판단했습니다)
구현된 폰트는 다음과 같습니다.
고민했던 점
caption1의 경우, 두 가의 Font Size(12, 10)를 갖고 있어서.font(.caption1(.bold(12)))과 같이 굵기 다음에 사이즈를 제시해주어야 합니다._10,_12또는size10,size12, ... 등pretendard(_:size:)를 넣었습니다.custom으로 시스템에서 제공하는 Font메서드처럼 해결하려 했는데, 자동완성에서 불편함을 보여.custom->.pretendard로 수정했습니다.해당 SPM을 추가하시고나서
FontRegistrar.registerFonts()를 실행해주셔야 합니다. 마치 Firebase의 configure()메서드 처럼요.그 이유는, 앱에서 info.plist에 폰트를 적용했던 것처럼, SPM에서도 이와 비슷한 작업을 해주어야하는데요. 그 코드가
FontRegistrar내부 메서드로 감싸져 있습니다. :)