I am trying to create apple map address link with latitude and longitude
i have tried like this:
let addrLoction = addressModel[indexPath.row]
let coord = addrLo.location
latitude = coord?.latitude
longitude = coord?.longitude
let mapAddr = "http://maps.apple.com/?q={latitude},{longitude}"
getting error:
Expected expression after operator
for eg: like android app goole maps address link, i need in apple map address link
Two issues:
latitude and longitude are optionals. Even if the String Interpolation syntax was right you'll get something like "Optional(45.000)". Use Optional Bindings.
The String Interpolation syntax is wrong, it's \(value)
if let coord = addrLo.location {
let latitude = coord.latitude
let longitude = coord.longitude
let mapAddr = "https://maps.apple.com/?q=\(latitude),\(longitude)"
// ...
}
And the URL scheme should be https