LBLocation
LBLocation class will help you get the user location very easy and make forward and reverse geocoding.
Install / Use
/learn @lucianboboc/LBLocationREADME
LBLocation
LBLocation class will help you get the user location very easy and make forward and reverse geocoding.
How to use LBLocation class into your project
Import <code>CoreLocation, MapKit</code> and <code>AddressBookUI</code> frameworks.
Create the LBLocation object using <code>initWithLocationUpdateBlock:</code>.
The completionBlock will be called with the <code>CLLocation</code> value or, in case of error the completionBlock is called with a <code>nil</code> value.
The LBLocation class uses <code>NSNotificationCenter</code> and calls the <code>startLocationServices</code> method when the <code>UIApplicationDidBecomeActiveNotification</code> notification is received. It also calls the <code>stopLocationServices</code> when the <code>UIApplicationWillResignActiveNotification</code> notification is received.
EXAMPLE
__weak ViewController *weakSelf = self;
self.location = [[LBLocation alloc] initWithLocationUpdateBlock:^(CLLocation *location) {
weakSelf.myLocation = location;
}];
Reverse Geocoding
You can use <code>reverseGeocodeCurrentLocationWithCompletionBlock:</code> and <code>reverseGeocodeLocation:completionBlock:</code> methods and the completion block will be called with a <code>CLPlacemark</code> object or <code>nil</code> value.
You can get a string with the address from the CLPlacemark object using the <code>addressStringFromPlacemark:</code> method.
Forward Geocoding
You can use the <code>geocodeAddressString:completionBlock:</code> and <code>geocodeAddressDictionary:completionBlock:</code> methods,pass a string or dictionary with the address and the completion block will be called with a <code>CLLocation</code> object or <code>nil</code> value.
LICENSE
This content is released under the MIT License https://github.com/lucianboboc/LBLocation/blob/master/LICENSE.md
Enjoy!
Related Skills
node-connect
351.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
