- Visits location service (CLVisit): most power-efficient way. Not for navigation or real-time. Good for doing async background processing related to location. Or to identify location pattern. Requires Always authorization.
- Region monitoring (Geofencing): Define a circular region and your app gets a notification when crossing the boundary. Apple’s built-in Reminder app uses that too. Very little battery consumption. It is built upon Core Location’s significant-change location service. Requires Always authorization.
- Significant-change location service: power-friendly way. Requires Always authorization.
- Standard location service: Real-time. Most power consumption.
Month: February 2018
When/what/how to cache
When? Read a lot, but no/min updates.
What? Images, API call results, computational results (e.g., row heights).
How? Use NSCache, networking frameworks that supports caching, set cache policy (e.g., NSURLRequest.CachePolicy.returnCacheDataElseLoad).
inout keyword
Use it when you need to pass the reference to a value variable (vs. just the value) into a function.
When to use unowned variable
Only when you want to use a weak variable but are sure it will never be nil once it has been set during initialization.