Initialize a CLLocation object in swift with latitude and longitude -


in objective c (i have no experience it) can initialize cllocation object latitude , longitude likes this:

cllocation *mylocation = [[cllocation alloc]  initwithlatitude:your_latitiude_value longitude:your_longitude_value]; 

but how do in swift?

i tried this,

let loc_coords = cllocationcoordinate2d(latitude: your_latitiude_value, longitude: your_longitude_value)  let loc = cllocation().coordinate(loc_coords) 

but error:

cannot invoke "coordinate" argument list of type '(cllocationcoordiate2d)'

i need cllocation object want use distancefromlocation method within locationmanager.

hope can help, thanks!

i not near mac test following should working. pass lat , lon values cllocaion initializer this:

let mylocation = cllocation(latitude: your_latitiude_value, longitude: your_longitude_value)  

for reference can check documentation


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -