Crash due to nil values
Closed this issue · 3 comments
siideffect commented
Hello, i was using this library with swift 3, and never had problems. However, when upgrading to swift 4, i noticed a strange issue when using FormToolbar.
Investigating the code i noticed that the buttons were set to nil. This, seems however to cause the crash:
/// Back/Forward button arrow direction
public var direction: Direction = .upDown {
didSet {
switch direction {
case .upDown:
backButtonType = .up
forwardButtonType = .down
case .leftRight:
backButtonType = .prev
forwardButtonType = .next
}
backButton = nil
forwardButton = nil
fixedSpacer = nil
updateBarItems()
}
}
/// Done button's title
/// Default is `"Done"`.
public var doneButtonTitle: String = "Done" {
didSet {
doneButton = nil
updateBarItems()
}
}
I ve commented out all the nil assignment and this prevented the app from crashing.
However, i would like to understand the reason of this crash. The problem seems to appear on the method updateBarItems()
sgr-ksmt commented
Please update FormToolbar to v1.1
siideffect commented
Thank you for the new commit, everything works again!