Skip to content

Commit

Permalink
refactor: shareText 수정, Diary 타입 id 위치 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhyunm committed Sep 10, 2023
1 parent bab2de1 commit f4130a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Diary+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ extension Diary {
@NSManaged public var title: String?
@NSManaged public var body: String?
@NSManaged public var createdAt: Date?
@NSManaged public var id: UUID?
}

extension Diary: Identifiable {}
extension Diary: Identifiable {
@NSManaged public var id: UUID?
}
8 changes: 6 additions & 2 deletions Diary/Protocol/ShareDisplayable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ extension ShareDisplayable where Self: UIViewController {
}

let date = DateFormatter().formatToString(from: createdAt, with: "YYYY년 MM월 dd일")
let shareText = "제목: \(title)\n작성일자: \(date)\n내용: \(body)"
let shareText = """
제목: \(title)
작성일자: \(date)
내용: \(body)
"""
let activityViewController = UIActivityViewController(activityItems: [shareText], applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view

self.present(activityViewController, animated: true, completion: nil)
}
}

0 comments on commit f4130a9

Please sign in to comment.