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]?) {
|
public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
if let unwrappedJson = json {
|
guard let unwrappedJson = json else { return }
|
||||||
actionMap = unwrappedJson
|
actionMap = unwrappedJson
|
||||||
self.additionalData = additionalData
|
self.additionalData = additionalData
|
||||||
self.delegateObject = delegateObject
|
self.delegateObject = delegateObject
|
||||||
buttonDelegate = delegateObject?.buttonDelegate
|
buttonDelegate = delegateObject?.buttonDelegate
|
||||||
|
|
||||||
let color = unwrappedJson.stringForkey(KeyTextColor)
|
let color = unwrappedJson.stringForkey(KeyTextColor)
|
||||||
setTitleColor(.mfGet(forHex: color), for: .normal)
|
setTitleColor(.mfGet(forHex: color), for: .normal)
|
||||||
|
|
||||||
titleLabel?.numberOfLines = 0
|
titleLabel?.numberOfLines = 0
|
||||||
titleLabel?.lineBreakMode = .byWordWrapping;
|
titleLabel?.lineBreakMode = .byWordWrapping;
|
||||||
setTitle(actionMap?.stringForkey(KeyTitle), for: .normal)
|
setTitle(unwrappedJson.stringForkey(KeyTitle), for: .normal)
|
||||||
|
|
||||||
if let enabled = unwrappedJson[KeyEnabled] as? Bool {
|
if let enabled = unwrappedJson[KeyEnabled] as? Bool {
|
||||||
isEnabled = enabled
|
isEnabled = enabled
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user