I have an array containing UIView subclass instances, and another array (of the same length) containing CGPoints. Without looping through the arrays, I'd like to assign the center property of each UIView subclass instance to the (index) associated CGPoint.
My first attempt looked something like UIViewArray.map {$0.center} = CGPointArray, but I quickly learned that map returns a copy of the array, so the assignment would be no good. The advice I've been able to find (e.g. this SO Q&A) only discusses using map for this sort of reassignment when the new parameter values are constant.
What's the best way to accomplish this task?
UIViewArrayandCGPointArrayare values, so they should be lowerCamelCase. UpperCamelCase is reserved for type names in Swift. These names don't really communicate anything that isn't obvious from the types. Consider perhapsviewsandcenterPoints. Their array-ness is implied by the plurality, and the fact that it'sCGPointis already clear from the type