Monday, 15 July 2013

ios - CLLocation to CLLocationCoordinate2D in swift -



ios - CLLocation to CLLocationCoordinate2D in swift -

hi had lot of problem in understanding declaration part in swift programming. have line of code cllocationcoordinate2d mycoordinate = mylocation.coordinate; same declared in swift programming i'm getting error

var location1:cllocation! = locationmanager1.location var coordinate1:cllocationcoordinate2d = location1.coordinate

fatal error: can't disclose optional.none

the location1 can nil, , have check whether or not nil before access proprties, e.g. this:

let locationmanager1: cllocationmanager // location manager // ... if allow location1: cllocation! = locationmanager1.location { var coordinate1: cllocationcoordinate2d = location1.coordinate // ... proceed location , coordintes } else { println("no location...") }

ios swift

No comments:

Post a Comment