Taehyeon-Kim / Mogakco

🕹 위치 기반 스터디 매칭 서비스
https://github.com/Taehyeon-Kim/Mogakco/wiki
2 stars 0 forks source link

[Refactor] 1차 정리 #57

Closed Taehyeon-Kim closed 1 year ago

Taehyeon-Kim commented 1 year ago
Taehyeon-Kim commented 1 year ago
  1. 시간 투자를 많이 못함
  2. 단기 집중이 필요함
Taehyeon-Kim commented 1 year ago

컬러

Taehyeon-Kim commented 1 year ago

폰트

// Static Methods
static func notoSansR(_ size: CGFloat) -> UIFont {
    return UIFont(.regular, size)
}

static func notoSansM(_ size: CGFloat) -> UIFont {
    return UIFont(.medium, size)
}

LineHeight

func setLineHeight(_ lineHeight: CGFloat) {
    if let text = self.text {
        let attributedString = NSMutableAttributedString(string: text)
        let style = NSMutableParagraphStyle()
        style.maximumLineHeight = lineHeight
        style.minimumLineHeight = lineHeight

        attributedString.addAttribute(
            NSAttributedString.Key.paragraphStyle,
            value: style,
            range: .init(location: 0, length: attributedString.length)
        )
        self.attributedText = attributedString
    }
}
Taehyeon-Kim commented 1 year ago

Repository 패턴

image

Data/Domain

스크린샷 2022-11-25 오후 9 45 36

Taehyeon-Kim commented 1 year ago

Content-Type에 대한 이해

application/x-www-form-urlencoded

// body parameters
/// application/x-www-form-urlencoded
if let parameters,
   let dicts = try parameters.toDictionary() {
    let output = dicts.lazy
        .map { ($0.key, $0.value) }
        .map { "\($0)=\($1)"}
        .joined(separator: "&")
    let data = output.data(using: .utf8)
    urlRequest.httpBody = data
}

application/json