発生している問題・エラーメッセージ
FireBase,MessageKitを使ってオリジナルのチャットアプリを作っているのですが、メッセージの上に表示される本来メッセージを送信した時間を表示させるところ現在時間が表示されてしまい困っています。(下の画像のような感じです)
該当のソースコード
swift
1// メッセージの上に文字を表示 2 func cellTopLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? { 3 if indexPath.section % 3 == 0 { 4 return NSAttributedString( 5 string: MessageKitDateFormatter.shared.string(from: message.sentDate), 6 attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 10), 7 NSAttributedString.Key.foregroundColor: UIColor.darkGray] 8 ) 9 } 10 return nil 11 }
追記
ちなみに送信ボタンを押した時FireBaseにメッセージを保存する仕組みになっています。
あなたの回答
tips
プレビュー