Because limit is an optional Int (Int?) it may be nil and not directly comparable with current. So first unwrap the optional to detect and avoid handle nil cases, and only compare non-nil cases.
if let limit = self.limit, current >= limit {
value = amount
} else {
value = current * 10 + amount
if value > self.max! {
value = amount
}
}