When you declare a structure in order to use it, you need to create an instance. The one structure is a type, just as Int is a type, and to use it you need to create an Int type variable:
var myInt:Int = 10
Similarly, once you define a structure, you can instantiate this structure and assign a variable:
var myStruct = one()
at this point you can access the properties and methods of the instance:
println(myStruct.name)
If you don't need an instance instead, you must declare the properties and methods as static :
struct one { static var name: String = "Ric" static var address: String = "Lee" }
and that the only case where you can refer to properties and call methods using a type, not an instance of a type:
println(one.name)
Side note: by convention, classes and struct (and, more commonly, any type) should be named with the first character in uppercase.
source share