Skip to content

Commit

Permalink
add auto-fill/auto-suggest feature to form fields
Browse files Browse the repository at this point in the history
Co-authored-by: Vui Nguyen <[email protected]>
Co-authored-by: Greg O'Neill <[email protected]>
  • Loading branch information
gioneill and vuinguyen committed Aug 8, 2018
1 parent c367dfe commit c27246f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions NYPLCardCreator/AddressViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ final class AddressViewController: FormTableViewController {
self.zipCell.textField.addTarget(self,
action: #selector(zipTextFieldDidChange),
for: .allEditingEvents)

if #available(iOS 10.0, *) {
self.street1Cell.textField.textContentType = .streetAddressLine1
self.street2Cell.textField.textContentType = .streetAddressLine2
self.cityCell.textField.textContentType = .addressCity
self.regionCell.textField.textContentType = .addressState
self.zipCell.textField.textContentType = .postalCode
}
}

func checkToPrefillForm() {
Expand Down
7 changes: 7 additions & 0 deletions NYPLCardCreator/NameAndEmailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ final class NameAndEmailViewController: FormTableViewController {
self.emailCell.textField.keyboardType = .emailAddress
self.emailCell.textField.autocapitalizationType = .none
self.emailCell.textField.autocorrectionType = .no

if #available(iOS 10.0, *) {
self.firstNameCell.textField.textContentType = .givenName
self.middleInitialCell.textField.textContentType = .middleName
self.lastNameCell.textField.textContentType = .familyName
self.emailCell.textField.textContentType = .emailAddress
}
}

func checkToPrefillForm() {
Expand Down

0 comments on commit c27246f

Please sign in to comment.