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

Date & Time

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

Side-by-side date and time fields.

Inputs · SwiftUI · iOS 17

  • inputs
  • swiftui

The actual source

PickerDateTimeField.swift
// Date & Time · syxUI · https://syxui.dev/components/picker-datetime
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let pkBlue = Color(red: 0.0, green: 0.47, blue: 1.0)

struct PickerDateTimeField: View { var body: some View { HStack(spacing: 10) { HStack(spacing: 8) { Image(systemName: "calendar").font(.system(size: 14)).foregroundStyle(pkBlue); Text("Jul 24").font(.system(size: 15)); Spacer() }.padding(.horizontal, 12).padding(.vertical, 12).overlay(RoundedRectangle(cornerRadius: 12).stroke(Color.primary.opacity(0.15))); HStack(spacing: 8) { Image(systemName: "clock").font(.system(size: 14)).foregroundStyle(pkBlue); Text("2:30 PM").font(.system(size: 15)); Spacer() }.padding(.horizontal, 12).padding(.vertical, 12).overlay(RoundedRectangle(cornerRadius: 12).stroke(Color.primary.opacity(0.15))) }.frame(width: 320) } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17