Skip to content
Date Divider preview
Rendered from the SwiftUI source on this page.

Date Divider

From syxUI — written for both platforms, not translated between them.

A centered day + time separator between messages.

Chat · SwiftUI · iOS 17

  • chat
  • swiftui

The actual source

ChatDateDivider.swift
// Date Divider · syxUI · https://syxui.dev/components/chat-date-divider
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Date divider
struct ChatDateDivider: View {
    var body: some View {
        HStack {
            Spacer()
            HStack(spacing: 5) {
                Text("Today").font(.system(size: 12, weight: .semibold)).foregroundStyle(.secondary)
                Text("9:41 AM").font(.system(size: 12)).foregroundStyle(.secondary.opacity(0.7))
            }
            Spacer()
        }
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17