Optional kann nicht aus String @ entfernt werd
Below ist mein Schnipsel
// MARK: - Location Functions
func getCurrentLocation() -> (String!, String!) {
let location = LocationManager.sharedInstance.currentLocation?.coordinate
return (String(location?.latitude), String(location?.longitude))
}
func setCurrentLocation() {
let (latitude, longitude) = getCurrentLocation()
let location = "\(latitude!),\(longitude!)"
print(location)
}
Obwohl ich optional mit @ auspaclatitude!
undlongitude!
, es druckt michOptional(37.33233141),Optional(-122.0312186)
Ich breche mir den Kopf, um die optionale Bindung zu entfernen.