So I have this custom struct
public struct Feature {
var featureID: String = ""
var featureName: String = ""
var matchingFieldValue: String = ""
var polygonCollection = [MyPolygon]()
mutating func setFeatureID(featureID: String) {
self.featureID = featureID
}
func getMatchingFieldValue() -> String {
return matchingFieldValue
}
mutating func setMatchingFieldvalue(matchingFieldValue: String) {
self.matchingFieldValue = matchingFieldValue
}
public func getPolygonCollection() -> [MyPolygon] {
return polygonCollection
}
}
and I am trying to append a polygon to my polygonCollection by calling this function
feature.getPolygonCollection().append(polygon)
but I am getting the error
cannot use mutating member on immutable value: function call returns immutable value
by the way, I am defining the polygon in another class, it is a long class so just put the relevant calling code that gives the error.
All the previously asked ques
I appreciate all the help.