Inside let gr you are targeting self, which is an instance of class foo.
Since you haven't initialised its two variables, compiler throws an error when you try to access them.
Swift doesn't accept this behaviour. I suggest you to declare them as Optional.