ServiceCredential.swift 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // ServiceCredential.swift
  3. // Loop
  4. //
  5. // Created by Nate Racklyeft on 7/2/16.
  6. // Copyright © 2016 Nathan Racklyeft. All rights reserved.
  7. //
  8. import UIKit
  9. /// Represents the input method for a service credential
  10. public struct ServiceCredential {
  11. /// The localized title of the credential (e.g. "Username")
  12. public let title: String
  13. /// The localized placeholder text to assist text input
  14. public let placeholder: String?
  15. /// Whether the credential is considered secret. Correponds to the `secureTextEntry` trait.
  16. public let isSecret: Bool
  17. /// The type of keyboard to use to enter the credential
  18. public let keyboardType: UIKeyboardType
  19. /// A set of valid values for presenting a selection. The first item is the default.
  20. public let options: [(title: String, value: String)]?
  21. public init(title: String, placeholder: String? = nil, isSecret: Bool, keyboardType: UIKeyboardType = .asciiCapable, options: [(title: String, value: String)]? = nil) {
  22. self.title = title
  23. self.placeholder = placeholder
  24. self.isSecret = isSecret
  25. self.keyboardType = keyboardType
  26. self.options = options
  27. }
  28. }