Created
April 13, 2022 15:56
-
-
Save romeugodoi/208b8b2e3a2d106ed93907fc61050130 to your computer and use it in GitHub Desktop.
Eureka Custom - AserFormViewController
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AserFormViewController.swift | |
// Aser RMS | |
// | |
// Created by Romeu Godoi on 28/08/17. | |
// Copyright © 2017 Aser Security. All rights reserved. | |
// | |
import UIKit | |
import Eureka | |
class AserFormViewController: FormViewController { | |
let formBGColor = Constants.formBGColor | |
let viewBGColor = Constants.viewBGColor | |
let blueDefault = Constants.blueDefault | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
AserFormViewController.setupAppearanceForm(form: self.form, tableView: self.tableView) | |
} | |
func setupAppearanceForm() { | |
AserFormViewController.setupAppearanceForm(form: self.form, tableView: self.tableView) | |
} | |
class func setupAppearanceForm(form: Form, tableView: UITableView) { | |
tableView.backgroundColor = Constants.viewBGColor | |
tableView.separatorColor = Constants.viewBGColor | |
TextRow.defaultCellUpdate = { cell, row in | |
cell.backgroundColor = Constants.formBGColor | |
cell.textLabel?.textColor = .white | |
cell.textField.placeHolderColor = .lightGray | |
cell.textField.textColor = .white | |
cell.textLabel?.font = UIFont.systemFont(ofSize: 15) | |
cell.textField?.font = UIFont.systemFont(ofSize: 15) | |
cell.tintColor = .white | |
} | |
TextAreaRow.defaultCellUpdate = { cell, row in | |
cell.backgroundColor = Constants.formBGColor | |
cell.placeholderLabel?.textColor = .lightGray | |
cell.placeholderLabel?.font = UIFont.systemFont(ofSize: 15) | |
cell.textView.font = UIFont.systemFont(ofSize: 15) | |
cell.textView.textColor = .white | |
cell.textView.backgroundColor = Constants.formBGColor | |
cell.tintColor = .white | |
} | |
ActionSheetRow<String>.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
} | |
ActionSheetRow<Int>.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
} | |
SegmentedRow<String>.defaultCellUpdate = { cell, row in | |
cell.backgroundColor = Constants.formBGColor | |
cell.titleLabel?.font = UIFont.systemFont(ofSize: 15) | |
cell.titleLabel?.textColor = .white | |
} | |
SwitchRow.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
} | |
PickerInputRow<Int>.defaultCellUpdate = { cell, row in | |
cell.backgroundColor = Constants.formBGColor | |
cell.textLabel?.font = UIFont.systemFont(ofSize: 15) | |
cell.textLabel?.textColor = .white | |
cell.selectedBackgroundView!.backgroundColor = Constants.selectedCellColor | |
} | |
URLRow.defaultCellUpdate = { cell, row in | |
cell.backgroundColor = Constants.formBGColor | |
cell.textLabel?.textColor = .white | |
cell.textField.placeHolderColor = .lightGray | |
cell.textField.textColor = .white | |
cell.textLabel?.font = UIFont.systemFont(ofSize: 15) | |
cell.textField?.font = UIFont.systemFont(ofSize: 15) | |
cell.tintColor = .white | |
} | |
DateRow.defaultCellUpdate = { cell, row in | |
cell.backgroundColor = Constants.formBGColor | |
cell.textLabel?.font = UIFont.systemFont(ofSize: 15) | |
cell.detailTextLabel?.font = UIFont.systemFont(ofSize: 15) | |
cell.textLabel?.textColor = .white | |
cell.selectedBackgroundView!.backgroundColor = Constants.selectedCellColor | |
} | |
DateTimeRow.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
} | |
DecimalRow.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
} | |
PushRow<NSObject>.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
} | |
PushRow<Int>.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
} | |
StepperRow.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
cell.tintColor = Constants.blueDefault | |
cell.valueLabel?.textColor = .white | |
} | |
SliderRow.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
cell.tintColor = Constants.blueDefault | |
} | |
EmailRow.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
} | |
LocationRow.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
} | |
PickerRow<String>.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
} | |
PickerRow<Int>.defaultCellUpdate = { cell, row in | |
AserFormViewController.setupAppearanceForm(to: cell) | |
} | |
} | |
class func setupAppearanceForm(to cell: UITableViewCell) { | |
cell.backgroundColor = Constants.formBGColor | |
cell.textLabel?.textColor = .white | |
cell.detailTextLabel?.textColor = .white | |
cell.textLabel?.font = UIFont.systemFont(ofSize: 15) | |
cell.detailTextLabel?.font = UIFont.systemFont(ofSize: 15) | |
cell.tintColor = .white | |
cell.selectedBackgroundView = UIView() | |
cell.selectedBackgroundView!.backgroundColor = Constants.selectedCellColor | |
if cell is TextFieldCell { | |
let cell = cell as! TextFieldCell | |
cell.textField?.font = UIFont.systemFont(ofSize: 15) | |
cell.textField.placeHolderColor = .lightGray | |
cell.textField?.textColor = .white | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment