for aresponse in self.response.question.responses {
The problem is that for aresponse in ... responses iterate through NSSet. Swift does not know what is in the NSSet, so it treats each aresponse value as an AnyObject that has no properties. Thus, the compiler complains when you try to get the score aresponse property.
On the other hand, you know that each aresponse value is an answer. So you need to say Swift, by casting (with as ). Note that you really did this in Objective-C code:
for(Response *aresponse in self.response.question.responses)
But you forgot to do the same in Swift. You can do this in many ways; for example, you could write a thing like this:
for aresponse in self.response.question.responses { var scoreVal = (aresponse as Response).score.integerValue
This forces us to bypass the compiler, which now shares our knowledge that this variable really is.
As soon as you get used to it, you will kiss the ground, which includes Swift. All this time, in Objective-C, you made assumptions about what kind of object you had, but actually what you had was id , and the compiler allowed you to send any message at all - and so, you often crashing with an "unrecognized selector". In Swift, an “unrecognized selector” failure is basically impossible, because the type of everything is set, and the compiler does not allow sending an unwanted message to an object in the first place.
source share