Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

Commit

Permalink
Release 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerome Tan authored and Jerome Tan committed Jun 10, 2016
1 parent 66fe5d3 commit 4b06d1a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,11 @@
# Change Log

## [1.2.0](https://github.com/JeromeTan1997/LocationPicker/releases/tag/1.2.0) (2016-06-10)

#### Enhancements

- Add the capability to allow the selection of locations that did not match or exactly match search results [#6](https://github.com/JeromeTan1997/LocationPicker/pull/6)

## [1.1.2](https://github.com/JeromeTan1997/LocationPicker/releases/tag/1.1.2) (2016-06-10)

#### API breaking changes
Expand Down
2 changes: 1 addition & 1 deletion LocationPicker/Info.plist
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.2</string>
<string>1.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion LocationPicker/LocationItem.swift
Expand Up @@ -66,7 +66,7 @@ public class LocationItem: NSObject, NSCoding {
}
}

/// The coordinate of the location. A reference to `MKMapItem` object's property `placemark.coordinate` and converted to tuple.
/// The coordinate of the location. A reference to `MKMapItem` object's property `placemark.coordinate` and converted to tuple. Only when the `allowArbitraryLocation` property of `LocationPicker` class is set to `true`, can this property be `nil`.
public var coordinate: (latitude: Double, longitude: Double)? {
get {
let coordinate = mapItem.placemark.coordinate
Expand Down
14 changes: 9 additions & 5 deletions LocationPicker/LocationPicker.swift
Expand Up @@ -201,7 +201,7 @@ public class LocationPicker: UIViewController, UISearchBarDelegate, UITableViewD


/**
Allows the selection of locations that did not exactly match search results.
Allows the selection of locations that did not match or exactly match search results.
- Note:
If an arbitrary location is selected, its coordinate in `LocationItem` will be `nil`. __Default__ is __`false`__.
Expand Down Expand Up @@ -768,10 +768,14 @@ public class LocationPicker: UIViewController, UISearchBarDelegate, UITableViewD
MKLocalSearch(request: localSearchRequest).startWithCompletionHandler({ (localSearchResponse, error) -> Void in
guard error == nil,
let localSearchResponse = localSearchResponse where localSearchResponse.mapItems.count > 0 else {
let locationItem = LocationItem(locationName: searchText)
self.searchResultLocations = [locationItem]
self.tableView.reloadData()
return
if self.allowArbitraryLocation {
let locationItem = LocationItem(locationName: searchText)
self.searchResultLocations = [locationItem]
} else {
self.searchResultLocations = []
}
self.tableView.reloadData()
return
}

self.searchResultLocations = localSearchResponse.mapItems.map({ LocationItem(mapItem: $0) })
Expand Down
2 changes: 1 addition & 1 deletion LocationPickerViewController.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LocationPickerViewController"
s.version = "1.1.2"
s.version = "1.2.0"
s.summary = "A ready for use and fully customizable location picker for your app."

s.homepage = "https://github.com/JeromeTan1997/LocationPicker"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -99,7 +99,7 @@ let package = Package(
name: "Your Project Name",
targets: [],
dependencies: [
.Package(url: "https://github.com/JeromeTan1997/LocationPicker.git", versions: "1.1.2" ..< Version.max)
.Package(url: "https://github.com/JeromeTan1997/LocationPicker.git", versions: "1.2.0" ..< Version.max)
]
)
```
Expand Down Expand Up @@ -193,6 +193,7 @@ __Grant__ button will direct user to the Settings where location access can be c

| Property name | Default | Target | Remark |
| ------------- |:-------:| ------ | ------ |
| allowArbitraryLocation | false | | Allows the selection of locations that did not match or exactly match search results |
| mapViewZoomEnabled | true | mapView.zoomEnabled | Whether the map view can zoom in and out |
| mapViewShowsUserLocation | true | mapView.showsUserLocation | Whether the map view shows user's location |
| mapViewScrollEnabled | true | mapView.scrollEnabled | Whether user can scroll the map view |
Expand Down Expand Up @@ -428,7 +429,7 @@ The hash value of `LocationItem` is `"\(coordinate.latitude), \(coordinate.longi
| Property name | Type | Target | Remark |
| ------------- |:----:| ------ | ------ |
| name | String | mapItem.name | The name of the location |
| coordinate | (latitude: Double, longitude: Double)? | mapItem.placemark.coordinate | The coordinate of the location and converted to tuple. If the user is offline or there is no search result, this property will be `nil` |
| coordinate | (latitude: Double, longitude: Double)? | mapItem.placemark.coordinate | The coordinate of the location and converted to tuple. If the user is offline or there is no search result and the `allowArbitraryLocation` property of `LocationPicker` is set to `true`, this property will be `nil` |
| addressDictionary | [NSObject: AnyObject]? | mapItem.placemark.addressDictionary | The address dictionary of the location |
| formattedAddressString | String? | addressDictionary?["FormattedAddressLines"] | The address text formatted according to user's region |

Expand Down

0 comments on commit 4b06d1a

Please sign in to comment.