Used guard instead of if let because some code after the if let was removed
This commit is contained in:
parent
8d417068a9
commit
87613fb375
@ -89,22 +89,21 @@ extension Link: MVMCoreUIMoleculeViewProtocol {
|
||||
}
|
||||
|
||||
public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
if let unwrappedJson = json {
|
||||
actionMap = unwrappedJson
|
||||
self.additionalData = additionalData
|
||||
self.delegateObject = delegateObject
|
||||
buttonDelegate = delegateObject?.buttonDelegate
|
||||
|
||||
let color = unwrappedJson.stringForkey(KeyTextColor)
|
||||
setTitleColor(.mfGet(forHex: color), for: .normal)
|
||||
|
||||
titleLabel?.numberOfLines = 0
|
||||
titleLabel?.lineBreakMode = .byWordWrapping;
|
||||
setTitle(actionMap?.stringForkey(KeyTitle), for: .normal)
|
||||
|
||||
if let enabled = unwrappedJson[KeyEnabled] as? Bool {
|
||||
isEnabled = enabled
|
||||
}
|
||||
guard let unwrappedJson = json else { return }
|
||||
actionMap = unwrappedJson
|
||||
self.additionalData = additionalData
|
||||
self.delegateObject = delegateObject
|
||||
buttonDelegate = delegateObject?.buttonDelegate
|
||||
|
||||
let color = unwrappedJson.stringForkey(KeyTextColor)
|
||||
setTitleColor(.mfGet(forHex: color), for: .normal)
|
||||
|
||||
titleLabel?.numberOfLines = 0
|
||||
titleLabel?.lineBreakMode = .byWordWrapping;
|
||||
setTitle(unwrappedJson.stringForkey(KeyTitle), for: .normal)
|
||||
|
||||
if let enabled = unwrappedJson[KeyEnabled] as? Bool {
|
||||
isEnabled = enabled
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user