Hi Gurus,
Here is my source
import UIKit
class NewUserInfoFormController: TKDataFormViewController {
let dataSource = TKDataFormEntityDataSource()
let physicianInfo = UserInfoModel()
let btn = UIButton()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.dataForm.backgroundColor = UIColor(red: 0.937, green: 0.937, blue: 0.960, alpha: 1.0)
dataSource.sourceObject = physicianInfo
dataSource["name"].hintText = "Please Enter Full Name"
dataSource["street"].hintText = "Street"
dataSource["city"].hintText = "City"
dataSource["state"].valuesProvider = GeoStates.state
//dataSource["state"].editorClass = TKDataFormOptionsEditor.self
dataSource["zip"].hintText = "Zip"
dataSource["phone"].hintText = "Phone"
dataSource["phone"].editorClass = TKDataFormPhoneEditor.self
dataSource["email"].hintText = "Email"
dataSource["email"].editorClass = TKDataFormEmailEditor.self
self.dataForm.dataSource = dataSource
self.dataForm.frame = CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: self.view.bounds.size.height - 66)
self.dataForm.tintColor = UIColor(red: 0.780, green: 0.2, blue: 0.223, alpha: 1.0)
btn.frame = CGRect(x: 0, y: self.dataForm.frame.size.height, width: self.view.bounds.size.width, height: 66)
btn.setTitle("Cancel reservation", for: UIControlState())
btn.setTitleColor(UIColor(red: 0.780, green: 0.2, blue: 0.223, alpha: 1.0), for: UIControlState())
btn.addTarget(self, action: #selector(NewPhysicianFormController.processSubmit), for: .touchUpInside)
self.view.addSubview(btn)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func dataForm(_ dataForm: TKDataForm, didCommit property: TKEntityProperty) {
if (property.name == "state'")
{
}
}
override func dataForm(_ dataForm: TKDataForm, update editor: TKDataFormEditor, for property: TKEntityProperty) {
//let feedbackDef = editor.gridLayout.definitionForView(editor.feedbackLabel)
//editor.gridLayout.setHeight(0, forRow: feedbackDef.row.integerValue)
if property.name == "state" {
}
if editor.isKind(of: TKDataFormTextFieldEditor.self) && property.name != "password" {
property.hintText = "Required"
}
}
func processSubmit() {
let alert = TKAlert()
alert.style.cornerRadius = 3;
alert.title = "Cancel Reservation";
alert.message = "Reservation Canceled!";
alert.addAction(withTitle: "OK") { (alert: TKAlert, action: TKAlertAction) -> Bool in
return true
}
alert.show(true)
}
}
How can I get the data stored in various fields in my processSubmit function. I want to be able to store those values in Core Data.
Thanks for your help