diff --git a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift index c11ffffe..9d101646 100644 --- a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift +++ b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift @@ -137,13 +137,13 @@ import UIKit // load new image if the width is different if let oldWidth = self.width, let newWidth = width, !MVMCoreGetterUtility.cgfequal(oldWidth, newWidth) { return true - } else if (self.width != nil && width == nil) || (self.width == nil && width != nil) { + } else if (self.width == nil) != (width == nil) { return true } // load new image if the height is different if let oldHeight = self.height, let newHeight = height, !MVMCoreGetterUtility.cgfequal(oldHeight, newHeight) { return true - } else if (self.height != nil && height == nil) || (self.height == nil && height != nil) { + } else if (self.height == nil) || (height == nil) { return true } return false @@ -195,15 +195,7 @@ import UIKit if let imageName = json?.optionalStringForKey("image"), shouldLoadImage(withName: imageName, width: width, height: height) { imageView.image = nil imageView.animatedImage = nil - var widthNumber: NSNumber? - if let width = width { - widthNumber = NSNumber(value: Double(width)) - } - var heightNumber: NSNumber? - if let height = height { - heightNumber = NSNumber(value: Double(height)) - } - loadImage(withName: imageName, format: json?.optionalStringForKey("imageFormat"), width: widthNumber, height: heightNumber, customFallbackImage: json?.optionalStringForKey("fallbackImage")) + loadImage(withName: imageName, format: json?.optionalStringForKey("imageFormat"), width: width as NSNumber?, height: height as NSNumber?, customFallbackImage: json?.optionalStringForKey("fallbackImage")) } }