Swift: Cannot assign to the result of the expression

ios, objective-c, swift

Solution

You're declaring `imageViewFrame` using `let` which makes it immutable.

You could use `var` instead of `let` for `imageViewFrame` which would make it mutable.

var imageViewFrame: CGRect = view.frame

Problem

I am upgrading my Objective-C code to Swift. I want to update the frame based on the image size like below: ``` let imageViewFrame: CGRect = view.frame if (image.size.width <= image.size.height) { imageViewFrame.origin.x = (view.frame.size.width - view.frame.size.height)/4 imageViewFrame.size.width = view.frame.size.height } ``` here I am getting an error saying: "Cannot assign to the result of the expression" what I should do to remove the error? Thanks in Advance!

Original source