-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
고민
- NSAttributedString와 NSMutableAttributedString 비교
- UIPasteboard의 클립 보드 활용
- Localizing
- 구성관련 모호함
회고
-
NSAttributedString와 NSMutableAttributedString
- NSAttributedString : 문자열 자체에 색상, 행간, 자간 등 스타일 요소 추가
- NSMutableAttributedString : 특정 범위의 NSRange 지정이 비교적 자유로운 부분 문자열에 대하여 색상, 행간, 자간 등 스타일 요소 추가
class ViewController: UIViewController { @IBOutlet weak var textView: UITextView! override func viewDidLoad() { super.viewDidLoad() let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineSpacing = 6.0 let attributes: [NSAttributedString.Key: Any] = [ .font: UIFont.systemFont(ofSize: 20.0, weight: .semibold), .foregroundColor: UIColor.systemBlue, .paragraphStyle: paragraphStyle ] let text = NSMutableAttributedString(string: "여름 장이란 애시당초에 글러서, 해는 아직 중천에 있건만 장판은 벌써 쓸쓸하고 더운 햇발이 벌여놓은 전 휘장 밑으로 등줄기를 훅훅 볶는다. 마을 사람들은 거의 돌아간 뒤요, 팔리지 못한 나무꾼패가 길거리에 궁깃거리고들 있으나, 석유병이나 받고 고깃마리나 사면 족할 이 축들을 바라고 언제까지든지 버티고 있을 법은 없다. 칩칩스럽게 날아드는 파리떼도 장난꾼 각다귀들도 귀찮다. 얽음뱅이요 왼손잡이인 드팀전의 허생원은 기어이 동업의 조선달을 나꾸어보았다.", attributes: attributes) paragraphStyle.paragraphSpacing = 10.0 let additionAttribute: [NSAttributedString.Key: Any] = [ .font: UIFont.systemFont(ofSize: 30.0, weight: .thin), .paragraphStyle: paragraphStyle, .foregroundColor: UIColor.systemPink ] text.addAttributes(additionAttribute, range: NSRange(location: 2, length: 10)) textView.attributedText = text } }
-
UIPasteboard 사용 시 오류
_LSSchemaConfigureForStore failed with error Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)"
M1 시뮬레이터 상에서 해당 버그 발생으로 클립 보드로 복사되지 않는 에러 발생, 로제타로 바꾸어 돌려보아도 동일 문제 지속 , 실 기기 빌드 시에는 정상 작동
스트링 이외에도 이미지, Url 등 다양한 데이터 타입 복사하도록 구성 가능 -
로컬라이징
string 파일을 통한 KeyValue 설정으로 언어마다 다른 대응이 가능하도록 구성
확실히 다른 사람도 알아볼 수 있도록 주석 구성이 필수 -
구성
이번 튜토리얼에서는 확실히 VC가 커지는 형식으로 앱을 구성하였는데, 테스터블 하도록 제대로 구성하면서 리팩토링 예정
MVVM, Rx 기반으로 1차 리팩토링
참고
👉🏻 M1 Xcode can't paste clipboard
👉🏻 UIPasteboard
👉🏻 Lokalize
Metadata
Metadata
Assignees
Labels
No labels