iOS/SwiftUI

textContentType

Hamp 2025. 10. 3. 19:59
반응형

🤖 textContentType

입력받을 TextField에 어떤 종류의 데이터를 넣을 지 미리 알려줌으로써
시스템에서 자동완성 및 제안과 같은 편리함을 제공

// UIKit
textField.textContentType = .emailAddress    // 이메일 입력
textField.textContentType = .username        // 사용자 아이디
textField.textContentType = .password        // 기존 비밀번호
textField.textContentType = .newPassword     // 새 비밀번호 (강력한 비밀번호 추천)
textField.textContentType = .oneTimeCode     // 인증번호 (SMS 자동완성 지원)
textField.textContentType = .telephoneNumber // 전화번호


// SwiftUI
.textContentType(.emailAddress)		// 이메일 입력
.textContentType(.password)			// 사용자 아이디
.textContentType(.newPassword)		// 새 비밀번호 (강력한 비밀번호 추천)
.textContentType(.oneTimeCode)		// 인증번호 (SMS 자동완성 지원)
.textContentType(.telephoneNumber)	// 전화번호

출처

https://developer.apple.com/documentation/uikit/uitextinputtraits/textcontenttype

 

textContentType | Apple Developer Documentation

The semantic meaning for a text input area.

developer.apple.com

 

반응형