Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Xcode
.DS_Store
Binary file added Example/.DS_Store
Binary file not shown.
Binary file added Example/Default-568h@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
<true/>
<key>SnapshotAutomaticallyBeforeSignificantChanges</key>
<false/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0460"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9C4A631C15B64A3F00E15FBA"
BuildableName = "SPGooglePlacesAutocomplete.app"
BlueprintName = "SPGooglePlacesAutocomplete"
ReferencedContainer = "container:SPGooglePlacesAutocomplete.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9C4A631C15B64A3F00E15FBA"
BuildableName = "SPGooglePlacesAutocomplete.app"
BlueprintName = "SPGooglePlacesAutocomplete"
ReferencedContainer = "container:SPGooglePlacesAutocomplete.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9C4A631C15B64A3F00E15FBA"
BuildableName = "SPGooglePlacesAutocomplete.app"
BlueprintName = "SPGooglePlacesAutocomplete"
ReferencedContainer = "container:SPGooglePlacesAutocomplete.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9C4A631C15B64A3F00E15FBA"
BuildableName = "SPGooglePlacesAutocomplete.app"
BlueprintName = "SPGooglePlacesAutocomplete"
ReferencedContainer = "container:SPGooglePlacesAutocomplete.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>SPGooglePlacesAutocomplete.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>9C4A631C15B64A3F00E15FBA</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
Binary file added Example/SPGooglePlacesAutocomplete/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@ @implementation AppDelegate
@synthesize window;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

SPGooglePlacesAutocompleteViewController *viewController = [[[SPGooglePlacesAutocompleteViewController alloc] init] autorelease];
SPGooglePlacesAutocompleteViewController *viewController = [[SPGooglePlacesAutocompleteViewController alloc] init];
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];

return YES;
}

- (void)dealloc {
[window release];
[super dealloc];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
BOOL shouldBeginEditing;
}

@property (retain, nonatomic) IBOutlet MKMapView *mapView;
@property (strong, nonatomic) IBOutlet MKMapView *mapView;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ - (void)viewDidUnload {
[super viewDidUnload];
}

- (void)dealloc {
[selectedPlaceAnnotation release];
[mapView release];
[searchQuery release];
[super dealloc];
}

- (IBAction)recenterMapToUserLocation:(id)sender {
MKCoordinateRegion region;
Expand Down Expand Up @@ -71,7 +65,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
static NSString *cellIdentifier = @"SPGooglePlacesAutocompleteCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}

cell.textLabel.font = [UIFont fontWithName:@"GillSans" size:16.0];
Expand All @@ -97,7 +91,6 @@ - (void)recenterMapToPlacemark:(CLPlacemark *)placemark {

- (void)addPlacemarkAnnotationToMap:(CLPlacemark *)placemark addressString:(NSString *)address {
[self.mapView removeAnnotation:selectedPlaceAnnotation];
[selectedPlaceAnnotation release];

selectedPlaceAnnotation = [[MKPointAnnotation alloc] init];
selectedPlaceAnnotation.coordinate = placemark.location.coordinate;
Expand Down Expand Up @@ -141,8 +134,7 @@ - (void)handleSearchForSearchString:(NSString *)searchString {
if (error) {
SPPresentAlertViewWithErrorAndTitle(error, @"Could not fetch Places");
} else {
[searchResultPlaces release];
searchResultPlaces = [places retain];
searchResultPlaces = places;
[self.searchDisplayController.searchResultsTableView reloadData];
}
}];
Expand Down Expand Up @@ -193,7 +185,7 @@ - (MKAnnotationView *)mapView:(MKMapView *)mapViewIn viewForAnnotation:(id <MKAn
static NSString *annotationIdentifier = @"SPGooglePlacesAutocompleteAnnotation";
MKPinAnnotationView *annotationView = (MKPinAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier];
if (!annotationView) {
annotationView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotationIdentifier] autorelease];
annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotationIdentifier];
}
annotationView.animatesDrop = YES;
annotationView.canShowCallout = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1536</int>
<string key="IBDocument.SystemVersion">11E2705</string>
<string key="IBDocument.InterfaceBuilderVersion">2818</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<int key="IBDocument.SystemTarget">1552</int>
<string key="IBDocument.SystemVersion">12C60</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.34</string>
<string key="IBDocument.HIToolboxVersion">625.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1900</string>
<string key="NS.object.0">2083</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBMKMapView</string>
Expand Down Expand Up @@ -43,7 +43,6 @@
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{320, 460}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1026728667"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIClipsSubviews">YES</bool>
Expand All @@ -56,22 +55,24 @@
<int key="NSvFlags">290</int>
<string key="NSFrameSize">{320, 44}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="189430553"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<int key="IBUIContentMode">3</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="IBUITextInputTraits" key="IBTextInputTraits">
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<array key="IBScopeButtonTitles" id="0"/>
<array key="IBScopeButtonTitles">
<string>Title</string>
<string>Title</string>
<string>Title</string>
</array>
</object>
<object class="IBUIButton" id="189430553">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{10, 395}, {32, 30}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
Expand Down Expand Up @@ -110,7 +111,6 @@
</array>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="430918752"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
Expand Down Expand Up @@ -222,7 +222,7 @@
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
Expand Down Expand Up @@ -291,6 +291,17 @@
<object class="IBPartialClassDescription">
<string key="className">SPGooglePlacesAutocompleteViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">recenterMapToUserLocation:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">recenterMapToUserLocation:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">recenterMapToUserLocation:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">mapView</string>
<string key="NS.object.0">MKMapView</string>
Expand All @@ -317,6 +328,6 @@
<string key="locateButton.png">{32, 30}</string>
<string key="location.png">{20, 20}</string>
</dictionary>
<string key="IBCocoaTouchPluginVersion">1900</string>
<string key="IBCocoaTouchPluginVersion">2083</string>
</data>
</archive>
7 changes: 7 additions & 0 deletions Source/APIKey.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#warning To use GooglePlacesAutocomplete, please register an APIKey for your application and set it here.

#define kGoogleAPIKey @""

// DO NOT CHECK IN CHANGES TO THIS FILE.
// Your API Key is private. To tell git to ignore local changes to this file,
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/*!
Contains the human-readable name for the returned result. For establishment results, this is usually the business name.
*/
@property (nonatomic, retain, readonly) NSString *name;
@property (nonatomic, strong, readonly) NSString *name;

/*!
Contains the primary 'type' of this place (i.e. "establishment" or "gecode").
Expand All @@ -29,12 +29,12 @@
/*!
Contains a unique token that you can use to retrieve additional information about this place in a Place Details request. You can store this token and use it at any time in future to refresh cached data about this Place, but the same token is not guaranteed to be returned for any given Place across different searches.
*/
@property (nonatomic, retain, readonly) NSString *reference;
@property (nonatomic, strong, readonly) NSString *reference;

/*!
Contains a unique stable identifier denoting this place. This identifier may not be used to retrieve information about this place, but can be used to consolidate data about this Place, and to verify the identity of a Place across separate searches.
*/
@property (nonatomic, retain, readonly) NSString *identifier;
@property (nonatomic, strong, readonly) NSString *identifier;

/*!
Resolves the place to a CLPlacemark, issuing Google Place Details request if needed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#import "SPGooglePlacesPlaceDetailQuery.h"

@interface SPGooglePlacesAutocompletePlace()
@property (nonatomic, retain, readwrite) NSString *name;
@property (nonatomic, retain, readwrite) NSString *reference;
@property (nonatomic, retain, readwrite) NSString *identifier;
@property (nonatomic, strong, readwrite) NSString *name;
@property (nonatomic, strong, readwrite) NSString *reference;
@property (nonatomic, strong, readwrite) NSString *identifier;
@property (nonatomic, readwrite) SPGooglePlacesAutocompletePlaceType type;
@end

Expand All @@ -21,7 +21,7 @@ @implementation SPGooglePlacesAutocompletePlace
@synthesize name, reference, identifier, type;

+ (SPGooglePlacesAutocompletePlace *)placeFromDictionary:(NSDictionary *)placeDictionary {
SPGooglePlacesAutocompletePlace *place = [[[self alloc] init] autorelease];
SPGooglePlacesAutocompletePlace *place = [[self alloc] init];
place.name = [placeDictionary objectForKey:@"description"];
place.reference = [placeDictionary objectForKey:@"reference"];
place.identifier = [placeDictionary objectForKey:@"id"];
Expand Down Expand Up @@ -81,12 +81,5 @@ - (void)resolveToPlacemark:(SPGooglePlacesPlacemarkResultBlock)block {
}
}

- (void)dealloc {
[name release];
[reference release];
[identifier release];
[geocoder release];
[super dealloc];
}

@end
Loading