Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
SwiftUI CustomTextFieldStyle example
import SwiftUI
typealias CustomTextFieldStyle = ViewModifier
extension View {
func customTextFieldStyle<S>(_ style: S) -> some View where S: CustomTextFieldStyle {
import SwiftUI
struct LargeTextFieldStyle: CustomTextFieldStyle {
func body(content: Content) -> some View {
VStack(spacing: 2) {
Rectangle().foregroundColor( .infinity, maxHeight: 2)
let font: Font = Font.system(size: 26, weight: .bold)
extension CustomTextFieldStyle where Self == LargeTextFieldStyle {
static var large: LargeTextFieldStyle { LargeTextFieldStyle() }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment