I want to show users current location in map and I know it's not instantaneous task. I want to call my showCurrentLocation() function in the ASYNC task. I was trying to learn call back closures but i could not understand how can I create ASYNC task for this. I know this is not a best question template for stackoverflow but I don't know how can I ask differently. Thank you for any help. Have a nice coding.
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- Disable Browser onUnload on certain links?
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Using if let syntax in switch statement
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Enum with associated value conforming to CaseItera
- How to create a CFuncType in Python
- Swift - hide pickerView after value selected
In the past I've made a class called AsyncTask for usage purposes like the one you described here.
Lately I've updated it for swift 3
It has 2 generic types:
BGParam
- the type of the parameter sent to the task upon execution.BGResult
- the type of the result of the background computation.If one of them(or both) isn't needed you can set it to Optional or just ignore.
In code example I refer the functions
showCurrentLocation()
&getCurrentLocation()
that you mentioned in OP & comments.BGParam
is set toInt
&BGResults
is set toCLLocationCoordinate2D
There is a technology called GCD (Grand Central Dispatch) which you can use to perform such tasks.