Why do i encounter 'cannot assign to property: function call returns immutable value' in swift?

This error surfaces when you attempt to modify a value returned from a function call directly, especially when that value is immutable.

Example:

  func getTuple() -> (Int, Int) {
      return (1, 2)
  }
  getTuple().0 = 3
  
Solution:

  var myTuple = getTuple()
  myTuple.0 = 3
  

Beginner's Guide to Swift