
Phone Field
From syxUI — written for both platforms, not translated between them.
A phone field with a country-code selector.
Inputs · SwiftUI · iOS 17
- inputs
- swiftui
The actual source
PhoneField.swift
// Phone Field · syxUI · https://syxui.dev/components/inp-phone
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
// Phone field with country code
struct PhoneField: View {
var body: some View {
HStack(spacing: 10) {
HStack(spacing: 4) { Text("US").font(.system(size: 15, weight: .semibold)); Text("+1").font(.system(size: 15)).foregroundStyle(.secondary); Image(systemName: "chevron.down").font(.system(size: 11)).foregroundStyle(.secondary) }.padding(.trailing, 10).overlay(alignment: .trailing) { Rectangle().fill(Color.primary.opacity(0.12)).frame(width: 1, height: 24) }
Text("(555) 123-4567").font(.system(size: 16)).foregroundStyle(.secondary)
Spacer()
}.padding(.horizontal, 14).padding(.vertical, 14).overlay(RoundedRectangle(cornerRadius: 12, style: .continuous).stroke(Color.primary.opacity(0.15), lineWidth: 1)).frame(width: 300)
}
}
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


