Skip to content

Commit

Permalink
refactor: 의도적인 개행 삭제되지 않도록 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhyunm committed Sep 10, 2023
1 parent f7ddf9a commit 12150ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Diary/Controller/CreateDiaryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ extension CreateDiaryViewController: UITextViewDelegate {
}

func textViewDidChange(_ textView: UITextView) {
let contents = textView.text.split(separator: "\n")
let contents = textView.text.components(separatedBy: "\n")
guard !contents.isEmpty,
let title = contents.first else { return }

Expand Down
4 changes: 3 additions & 1 deletion Diary/Controller/DiaryListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ extension DiaryListViewController: UITableViewDataSource {
let diaryEntity = diaryList[indexPath.row]
guard let title = diaryEntity.title,
let createdAt = diaryEntity.createdAt,
let body = diaryEntity.body else { return UITableViewCell() }
let body = diaryEntity.body?.split(separator: "\n").joined(separator: "\n") else {
return UITableViewCell()
}
let date = dateFormatter.formatToString(from: createdAt, with: "YYYY년 MM월 dd일")

cell.setModel(title: title, date: date, body: body)
Expand Down

0 comments on commit 12150ec

Please sign in to comment.