OliverKDM
(Oliver Ferris)
1
Hi,
Im tying to use a variable outside of a function, I've searched many different solitons and none seem to work
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location = locations[0]
/
let Speed = location.speed * 2.236936284
SpeedLabel.text = "\(Speed)"
}
I wish to use the variable "Speed" elsewhere in my program.. How can this be done?
Any help is appreciated
Thanks
Oliver
Hello Oliver,
Is assigning it to an external variable not an option? If not, could you elaborate on your case?
1 Like
ckeithray
(C. Keith Ray)
3
1 Like
ckeithray
(C. Keith Ray)
4
ckeithray
(C. Keith Ray)
5
var speed : Double = 0.0
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location = locations[0]
speed = location.speed * 2.236936284
SpeedLabel.text = "\(speed)"
}
C. Keith Ray
https://leanpub.com/wepntk <- buy my book?
http://agilesolutionspace.blogspot.com/
twitter: @ckeithray
http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf