View Full Version : learning swift programming and need a little guidance

24-02-2016, 19:15
Hi all,

I'm having fun and game attempting to learn swift for iOS. I've understood the var, let, Double, Int, String and so on. However what I'm really struggling with is extracting a value/result from a func/struct/class. I'm constantly getting unresolved identifier or when i print() i either get "function" or nothing.

I posted on Stack Overflow http://stackoverflow.com/questions/35587580/class-or-struct-for-extracting-maths-swift/35589368#35589368 I got an answer that worked (no errors) but still couldn't get a value to extract.


I'm enjoying the challenge my god is it the most frustrating thing in the world! I will carry on reading and watching some videos, now I wish I'd done this at school and not in my 30s.


struct Fuel {
var rate = 3.7
var laps = 13
var totalFuel: Double {
return (rate * Double(laps))


I cannot for the life of me print the result, the code works and throws no errors in Xcode playground