In iOS utilizing WIPER Structure and I’m making an attempt to supply an Look to TextFormField named updateMemoField.
Already there was to TextFormFields as under:
@IBOutlet weak var brandValue: BorderedTextField?
@IBOutlet weak var allocationValue: BorderedTextField?
then calling setViewAppearance(look: show)
override func awakeFromNib() {
tremendous.awakeFromNib()
do {
appearanceProvider = attempt DependencyContainer.shared.resolve() as BMLineItemAppearanceProvider
} catch {
log.error("Couldn't load BMLineItemAppearanceProvider class")
}
look = appearanceProvider?.bmLineItemAppearance
if let show = look {
setViewAppearance(look: show)
}
}
you’ll be able to verify methodology under:
personal func setViewAppearance(look: BMLineItemAppearance) {
setAllFields(look: look)
...
}
setAllFields methodology is as under:
personal func setAllFields(look: BMLineItemAppearance) {
let fields = [brandValue: localizedKey(key: "select"),
allocationValue: localizedKey(key: "select")]
for merchandise in fields {
merchandise.key?.configureAppearance(look.textAppearance, fieldAppearanceType: .formText)
merchandise.key?.borderedEdges = BorderedEdge.all
merchandise.key?.placeholder = merchandise.worth
merchandise.key?.tintColor = .clear
merchandise.key?.delegate = self
merchandise.key?.dropdownButton(completionHandler: {
self.onClickDropDownFields(area: merchandise.key!)
})
}
}
That is working wonderful. However, Now I want so as to add yet one more TextFormField (BorderedTextField) in my UI so merely I declared variable as under:
@IBOutlet weak var updateMemoField: BorderedTextField?
and Tried to supply look to it as under by creating a technique:
personal func setUpdateMemoFieldsAppearance(look: BMLineItemAppearance) {
guard let updateMemoField = updateMemoField else {
print("updateMemoField is nil, skipping configuration.")
return
}
updateMemoField.tintColor = .blue
updateMemoField.configureAppearance(look.textAppearance, fieldAppearanceType: .formText)
updateMemoField.returnKeyType = .default
updateMemoField.autocorrectionType = .no
updateMemoField.borderedEdges = BorderedEdge.all
updateMemoField.delegate = self
}
Calling this methodology inside setAllFields
as under:
personal func setAllFields(look: BMLineItemAppearance) {
let fields = [brandValue: localizedKey(key: "select"),
allocationValue: localizedKey(key: "select")]
for merchandise in fields {
merchandise.key?.configureAppearance(look.textAppearance, fieldAppearanceType: .formText)
merchandise.key?.borderedEdges = BorderedEdge.all
merchandise.key?.placeholder = merchandise.worth
merchandise.key?.tintColor = .clear
merchandise.key?.delegate = self
merchandise.key?.dropdownButton(completionHandler: {
self.onClickDropDownFields(area: merchandise.key!)
})
}
setUpdateMemoFieldsAppearance(look:look)
}
and runtime am getting error as :
Thread 1: EXC_BAD_INSTRUCTION (code=1, subcode=0x0)
What may be the problem?