almassapargali / locationpicker Goto Github PK
View Code? Open in Web Editor NEWiOS location picker view controller
License: MIT License
iOS location picker view controller
License: MIT License
i.e., without asking for user's location permission and without presenting the user's location on map.
Just let him type city/country with autocomplete suggestions.
Thanks for sharing this library!
I installed LocationPicker module using pod.
But can't import module. (Xcode 8.3, Swift 3.0)
It would be helpful if you published the spec as the same name as the package manager.
Now it is public
, in this case I can't inherit it, better to use open
Hello!
I just added LocationPickerViewController as navigationItem to my navigationController. Everything is fine except I'm unable to type text to search for location in searchBar. I can clean search field. I've checked both controllers' settings - they are equal. Could you tell me what's wrong?
Thanks!
Hi,
Nice work with this picker.
However, I use it in Obj-C project and I want the user to be able to select the current location.
If I press on the standard locate button, the location is not selectable.
How can I do it in your code, using swift? The pin should be added on the current user location.
Thanks.
I want to selected last selected location from map but I have only address string and coordinates for location constructor, placeMark paramter ? can you please remove it ? or fix to stop crashing
let initialLocation = Location(name: "My home", location: location, placeMark: CLPlaceMark )
Hello all!
Thanks for amazing LocationPicker, this library helped me a lot!
I am curious if there's possibility to set latitude / longitude bounds (like Android's LatLngBounds
)
for ViewController (northeast
and southwest
coordinates I guess)
The sample posted no longer compiles with xCode 8.1 and Swift 3.
The problem lies on the line:
let initialLocation = Location(name: "my home", location: location)
"Missing argument for parameter 'placemark' in call". The compiler wants:
let initialLocation = Location(name: "my home", location: location, placemark: placemark)
I've been trying to understand how to init CLPlacemark from CLLocation, but I've had no luck.
I can not get xCode to recognize init(location: CLLocation, name: String?, postalAddress: CNPostalAddress?) so I do not have an easy way to create a CLPlacemark from CLLocation.
If I pass in an empty CLPlacemark, it crashes.
Long tap somewhere, and while the pin is dropping (or at least before the info shows up) , long tap somewhere else.
Expected: First pin is dismissed.
What actually happens: First pin is dismissed, but an alert shows up with the following message: The operation couldn't be completed. (kCLErrorDomain error 10.)
.
Hi @almassapargali , thanks for the great plugin!
I am wondering if it is possible to add the "Select" button for "Current Location" annotation? Currently when tapping on the blue circle of current location, it shows the annotation but not the Select button.
Any way I can enable it or add it in?
Thanks!
Any plan to update library to Swift 3 ?
After doing pod install I am greeted with this error
Analyzing dependencies
[!] Unable to find a specification for LocationPicker
Setting the map type doesn't change the actual map.
When closing controller it's not release from memory
I want feature change drop pin on map
Hi sir,
would it possible to add option so that on tap to change the current location?
currently long tap will do it, but most of user might don't know this.
Because this is location picker, so this option would be very helpful i think.
(i test android lib https://github.com/SchibstedSpain/Leku, which does this)
thanks :)
In my project I have a Table View Controller embedded in a Navigation Controller. I am launching the LocationPickerViewController via a button in the navigation bar.
Sometimes when I don't select any location and go back to the previous screen and again come to the Location Picker scene the following error is printed to the console:
Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x14a851f90>)
Searching the web, I found this stackoverflow answer which recommended to call the loadViewIfNeeded() method of the UISearchController in the class' deinit.
I added it as follows in LocationPickerViewController:
deinit {
searchTimer?.invalidate()
localSearch?.cancel()
geocoder.cancelGeocode()
searchController.loadViewIfNeeded() // Added call to loadViewIfNeeded()
}
The error does not appear anymore after this. Maybe this call to loadViewIfNeeded() needs to be added.
I want to add a button to get current location in completion handler. How it can be done.
Version 1.3.0 does not propagate to cocoapods, see last release.
Did you pod lib lint
the latest version? Maybe it fails because the .swift-version
still says 3.0
?
Whatever the reason is, the update is not available...
selectCurrentLocationInitially is set true but when i tapped on right bottom icon for current location , there is no marker and map is not updating for current location
here is my code
let locationPicker = LocationPickerViewController()
locationPicker.location = location
locationPicker.searchBarStyle = .prominent
locationPicker.mapType = .standard
locationPicker.showCurrentLocationButton = true
locationPicker.useCurrentLocationAsHint = true
locationPicker.selectCurrentLocationInitially = true
locationPicker.completion = { location in
self.lat = location?.coordinate.latitude ?? 0.0
self.long = location?.coordinate.longitude ?? 0.0
self.txtaddress.text = location?.address ?? "--"
}
navigationController?.pushViewController(locationPicker, animated: true)
Hi!
Thank you for this beautiful framework
How can i forbid map rotation?
mapView.isRotateEnabled = false
Hi If I open this control as Presented there is no button to close window. How I could add one?
@almassapargali so are you going to update the project to swift 4. Can you let me know. You messaged us telling the community that you were working on it. Is this a broken framework.
Hi. Would you kindly help with my problem. I tapped on the searchBar but it did not allow me to edit. Nothing happens when I tapped on it.
changing searchBarPlaceholder is changing its value but not the searchbar placeholder value
i think this fix it
LocationPickerViewController
/// default: "Search or enter an address"
public var searchBarPlaceholder : String = "Search or enter an address" {
didSet{
searchBar.placeholder = self.searchBarPlaceholder
}
}
How can I select the current location when initialy after opening the map, because currently it only shows the current location and the user may think it is already selected or even when the user tap the current location circle it does nothing and the user still has to tap long to select the locatoin
Please add support for Objective-C projects too.
The button title for the "select location button" created in LocationPickerViewController.selectLocationButton()
uses a hardcoded string. It would make sense to have this text customisable from outside to enable localisation and also using an app specific verb.
Note that your git tag should also point to a later commit where the podspec also has the correct 1.0.0 version.
Any way I can use this with google maps instead of apple maps?
I can change it in the locationpicker file but I don't have write access, and I can't access the searchbar style. Any suggestions?
please. thanks, it will make us pick up your changes much easier.
Please, change public
type of the class into open
class.
I would mix this library with the other but I have to change this restriction properties manually.
For cocoapods this is not a good solution.
This picker is idea for apps that don't use location and maps too much, therefore dealing with location permissions would be ideal. At least for my use case.
I could implement it and send a pull request in the following few days if this sounds like something important.
This can be a configurable feature, like locationPicker.askForPermission
, and can take three values .No
, .WhenInUse
, .Always
, so the app developers can choose what level of permission to ask for, just in case they use location in different parts of the app.
What do you think?
Hello, I am trying to integrate the pod file in my app and it is taking forever.
Please take a look at my pod file.
use_frameworks!
target 'UberDemo6' do
pod 'UberRides'
pod 'LocationPicker'
end
How can i change the text in the map envoirment, i want to put the text in portuguese or french.
Regards
Can I restrict the search for only Schools? I need to search for schools ONLY
I am using swift4 and the latest xCode
Thank you
Error Happen After Latest Xcode Update when initiating LocationPickerViewController
xCode throws method deprecation warnings when Deployment Target is set to 9.2
LocationPicker/LocationPicker/Location.swift:30:12: 'ABCreateStringWithAddressDictionary' was deprecated in iOS 9.0: Use CNPostalAddressFormatter from Contacts.framework instead
LocationPicker/LocationPicker/LocationPickerViewController.swift:325:7: 'pinColor' was deprecated in iOS 9.0: Use pinTintColor instead
Thanks for a great and useful component.
In my case, I have to be able to show this component any where independent of any navigation sequence. So being able to show it modally is important. However this component seems to be designed to work with UINavigationController.
So here is how currently do it.
@objc func openLocationPicker() {
// setup the location picker
let locationPicker = LocationPickerViewController()
// add cancel button to dismiss it
locationPicker.navigationItem.leftBarButtonItem =
UIBarButtonItem(title: "Cancel", style: .plain, target: self, action: #selector(closeLocationPicker))
// set the wrapper
let nc = UINavigationController(rootViewController: locationPicker)
// show it modally
UIApplication.shared
.topViewController()?
.present(nc, animated: true, completion: {})
}
// dismiss the modally presented LocationPicker
@objc func closeLocationPicker() {
UIApplication.shared
.topViewController()?
.presentedViewController?.dismiss(animated: true, completion: nil)
}
Hope this can be useful for others who got in situation like this.
Thanks!
Hi, how can a print de location (Latitude and longitude) when i pick a and select a new location ?
Its not support in xcode 9?
Hi,
I'm trying to localize the text used in the AnnotationView. I saw you updated the view a few days ago and now we can set the selectButtonTitle of the AnnotationView. Is there a way to make the AnnotationView larger when the selectButtonTitle text is larger than normal? For instance Select is in Dutch Selecteer which doesn't fit right now in the AnnotationView.
Thx!
How can i make the searchBar become firstRespond on view will appear and how to i pass the location to the previous view controller that triggered the location picker
Hi there, very nice tool.
Is it possible to localize all aspects of this location picker? This would include not only the searchBarPlaceholder and the searchHistoryLabel, but also the Back button, the Cancel button, the Select button and the language of the addresses?
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.