Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Access struct value again

dickthedevdickthedev Posts: 214Registered Users @ @
Hello, I am a swift 3 newbie, so some concept is a bit foggy in my mind please forgive my dumb question.

My last post wasn't very clear. I am puzzled by how to use a struct as a global in various part of a program.

I defined a struct like this:
[code]
struct Resolution {
var width: Int?
var height: Int?
}

func myFunc() {
let someResolution = Resolution(width: 2048, height: 1900 )

print(someResolution.width!)
print(someResolution.height!)
}

print(myFunc())

Now myFunc initialized struct Resolution,
but how do I access the width and height from another function later on? Thanks.
Sign In or Register to comment.