Skip to content

Instantly share code, notes, and snippets.

@alexruperez alexruperez/Podfile
Created Jan 30, 2019

Embed
What would you like to do?
MaterialTextInputOutlined iOS PoC
platform :ios, '10.3'
target 'MaterialTextInputOutlinedPoC' do
use_frameworks!
pod 'MaterialComponents/TextFields+ColorThemer', '~> 75.0'
pod 'MaterialComponents/TextFields+TypographyThemer', '~> 75.0'
end
// Created by Alex Rupérez.
// Copyright © 2019 Globant.
import UIKit
import MaterialComponents.MaterialTextFields
class ViewController: UIViewController {
@IBOutlet weak var textField: MDCTextField!
var textFieldControllerOutlined: MDCTextInputControllerOutlined!
override func viewDidLoad() {
super.viewDidLoad()
view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(textFieldShouldReturn(_:))))
let colorScheming: MDCColorScheming = MDCSemanticColorScheme()
MDCTextFieldColorThemer.apply(colorScheming, toAllControllersOfClass: MDCTextInputControllerOutlined.self)
let typographyScheming: MDCTypographyScheming = MDCTypographyScheme()
MDCTextFieldTypographyThemer.apply(typographyScheming, toAllControllersOfClass: MDCTextInputControllerOutlined.self)
textField.placeholder = "Text Input Outlined"
textField.delegate = self
textFieldControllerOutlined = MDCTextInputControllerOutlined(textInput: textField)
}
}
extension ViewController: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
self.textField.resignFirstResponder()
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.