Skip to content

Commit e888be8

Browse files
committed
Update to use GooglePlaces SDK instead of big GoogleMaps
1 parent 67b8c56 commit e888be8

File tree

102 files changed

+1844
-26
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1844
-26
lines changed

Cartfile.resolved

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "xmartlabs/Eureka" "1.5.0"
1+
github "xmartlabs/Eureka" "1.6.0"

Example.xcodeproj/project.pbxproj

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
28F828D71C4B714D00330CF4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 28F828D61C4B714D00330CF4 /* Assets.xcassets */; };
1616
28F828DA1C4B714D00330CF4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28F828D81C4B714D00330CF4 /* LaunchScreen.storyboard */; };
1717
8F3EDFA21CBFCE1E000754B7 /* GooglePlacesRow.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 287D0A7A1C4B7B26004566D6 /* GooglePlacesRow.framework */; };
18+
8FCDF8721D4BB4F1005FE478 /* Eureka.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8FCDF8711D4BB4F1005FE478 /* Eureka.framework */; };
19+
8FCDF8731D4BB4F1005FE478 /* Eureka.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8FCDF8711D4BB4F1005FE478 /* Eureka.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1820
/* End PBXBuildFile section */
1921

2022
/* Begin PBXContainerItemProxy section */
@@ -56,6 +58,7 @@
5658
dstSubfolderSpec = 10;
5759
files = (
5860
287D0A7E1C4B7B55004566D6 /* GooglePlacesRow.framework in Embed Frameworks */,
61+
8FCDF8731D4BB4F1005FE478 /* Eureka.framework in Embed Frameworks */,
5962
);
6063
name = "Embed Frameworks";
6164
runOnlyForDeploymentPostprocessing = 0;
@@ -74,6 +77,7 @@
7477
28F828DB1C4B714D00330CF4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Example/Info.plist; sourceTree = "<group>"; };
7578
28F828E01C4B714D00330CF4 /* ExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
7679
28F828E61C4B714D00330CF4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = Info.plist; path = Example/ExampleUITests/Info.plist; sourceTree = "<group>"; };
80+
8FCDF8711D4BB4F1005FE478 /* Eureka.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Eureka.framework; path = Carthage/Build/iOS/Eureka.framework; sourceTree = "<group>"; };
7781
/* End PBXFileReference section */
7882

7983
/* Begin PBXFrameworksBuildPhase section */
@@ -82,6 +86,7 @@
8286
buildActionMask = 2147483647;
8387
files = (
8488
8F3EDFA21CBFCE1E000754B7 /* GooglePlacesRow.framework in Frameworks */,
89+
8FCDF8721D4BB4F1005FE478 /* Eureka.framework in Frameworks */,
8590
);
8691
runOnlyForDeploymentPostprocessing = 0;
8792
};
@@ -149,6 +154,7 @@
149154
8F3EDFA11CBFCDCB000754B7 /* Frameworks */ = {
150155
isa = PBXGroup;
151156
children = (
157+
8FCDF8711D4BB4F1005FE478 /* Eureka.framework */,
152158
);
153159
name = Frameworks;
154160
sourceTree = "<group>";
@@ -435,6 +441,7 @@
435441
FRAMEWORK_SEARCH_PATHS = (
436442
"$(inherited)",
437443
"$(PROJECT_DIR)/Frameworks",
444+
"$(PROJECT_DIR)/Carthage/Build/iOS",
438445
);
439446
INFOPLIST_FILE = "$(SRCROOT)/Example/Example/Info.plist";
440447
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -451,6 +458,7 @@
451458
FRAMEWORK_SEARCH_PATHS = (
452459
"$(inherited)",
453460
"$(PROJECT_DIR)/Frameworks",
461+
"$(PROJECT_DIR)/Carthage/Build/iOS",
454462
);
455463
INFOPLIST_FILE = "$(SRCROOT)/Example/Example/Info.plist";
456464
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";

Example/Example/AppDelegate.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
import UIKit
9-
import GoogleMaps
9+
import GooglePlaces
1010

1111
@UIApplicationMain
1212
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -17,7 +17,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1717
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
1818
//TODO: Set API_KEY
1919
let apiKey = "YOUR_API_KEY"
20-
GMSServices.provideAPIKey(apiKey)
20+
GMSPlacesClient.provideAPIKey(apiKey)
21+
print(GMSPlacesClient.openSourceLicenseInfo())
2122
if apiKey == "YOUR_API_KEY" {
2223
print("IF YOU SEE THIS IN YOUR CONSOLE IT'S BECAUSE YOU FORGOT TO SET YOUR API_KEY")
2324
assertionFailure()

Example/Example/ViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import UIKit
99
import GooglePlacesRow
1010
import Eureka
11-
import GoogleMaps
11+
import GooglePlaces
1212

1313
class ViewController: FormViewController {
1414

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/GoogleMapsBase
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Headers
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Modules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Resources
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//
2+
// GMSCompatabilityMacros.h
3+
// Google Maps SDK for iOS
4+
//
5+
// Copyright 2015 Google Inc.
6+
//
7+
// Usage of this SDK is subject to the Google Maps/Google Earth APIs Terms of
8+
// Service: https://developers.google.com/maps/terms
9+
//
10+
11+
#import <Foundation/Foundation.h>
12+
13+
#if !__has_feature(nullability) || !defined(NS_ASSUME_NONNULL_BEGIN) || \
14+
!defined(NS_ASSUME_NONNULL_END)
15+
#define GMS_ASSUME_NONNULL_BEGIN
16+
#define GMS_ASSUME_NONNULL_END
17+
#define GMS_NULLABLE
18+
#define GMS_NULLABLE_PTR
19+
#define GMS_NULLABLE_INSTANCETYPE instancetype
20+
#else
21+
#define GMS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
22+
#define GMS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
23+
#define GMS_NULLABLE nullable
24+
#define GMS_NULLABLE_PTR __nullable
25+
#define GMS_NULLABLE_INSTANCETYPE nullable instancetype
26+
#endif
27+
28+
#if __has_feature(objc_generics) && defined(__IPHONE_9_0) && \
29+
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0
30+
#define GMS_DECLARE_GENERICS 1
31+
#else
32+
#define GMS_DECLARE_GENERICS 0
33+
#endif
34+
35+
#if GMS_DECLARE_GENERICS
36+
#define GMS_NSArrayOf(value) NSArray<value>
37+
#define GMS_NSDictionaryOf(key, value) NSDictionary<key, value>
38+
#define GMS_NSSetOf(value) NSSet<value>
39+
#else
40+
#define GMS_NSArrayOf(value) NSArray
41+
#define GMS_NSDictionaryOf(key, value) NSDictionary
42+
#define GMS_NSSetOf(value) NSSet
43+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
//
2+
// GMSCoordinateBounds.h
3+
// Google Maps SDK for iOS
4+
//
5+
// Copyright 2013 Google Inc.
6+
//
7+
// Usage of this SDK is subject to the Google Maps/Google Earth APIs Terms of
8+
// Service: https://developers.google.com/maps/terms
9+
//
10+
11+
#import <CoreLocation/CoreLocation.h>
12+
13+
#import <GoogleMapsBase/GMSCompatabilityMacros.h>
14+
15+
GMS_ASSUME_NONNULL_BEGIN
16+
17+
/**
18+
* GMSCoordinateBounds represents a rectangular bounding box on the Earth's
19+
* surface. GMSCoordinateBounds is immutable and can't be modified after
20+
* construction.
21+
*/
22+
@interface GMSCoordinateBounds : NSObject
23+
24+
/** The North-East corner of these bounds. */
25+
@property(nonatomic, readonly) CLLocationCoordinate2D northEast;
26+
27+
/** The South-West corner of these bounds. */
28+
@property(nonatomic, readonly) CLLocationCoordinate2D southWest;
29+
30+
/**
31+
* Returns NO if this bounds does not contain any points.
32+
* For example, [[GMSCoordinateBounds alloc] init].valid == NO.
33+
* When an invalid bounds is expanded with valid coordinates via
34+
* includingCoordinate: or includingBounds:, the resulting bounds will be valid
35+
* but contain only the new coordinates.
36+
*/
37+
@property(readonly, getter=isValid) BOOL valid;
38+
39+
/**
40+
* Inits the northEast and southWest bounds corresponding
41+
* to the rectangular region defined by the two corners.
42+
*
43+
* It is ambiguous whether the longitude of the box
44+
* extends from |coord1| to |coord2| or vice-versa;
45+
* the box is constructed as the smaller of the two variants, eliminating the
46+
* ambiguity.
47+
*/
48+
- (id)initWithCoordinate:(CLLocationCoordinate2D)coord1
49+
coordinate:(CLLocationCoordinate2D)coord2;
50+
51+
/**
52+
* Returns a GMSCoordinateBounds representing
53+
* the current bounds extended to include the passed-in coordinate.
54+
* If the current bounds is invalid, the result is a valid bounds containing
55+
* only |coordinate|.
56+
*/
57+
- (GMSCoordinateBounds *)includingCoordinate:(CLLocationCoordinate2D)coordinate;
58+
59+
/**
60+
* Returns a GMSCoordinateBounds representing
61+
* the current bounds extended to include the entire other bounds.
62+
* If the current bounds is invalid, the result is a valid bounds equal
63+
* to |other|.
64+
*/
65+
- (GMSCoordinateBounds *)includingBounds:(GMSCoordinateBounds *)other;
66+
67+
/**
68+
* Returns YES if |coordinate| is contained within this bounds. This includes
69+
* points that lie exactly on the edge of the bounds.
70+
*/
71+
- (BOOL)containsCoordinate:(CLLocationCoordinate2D)coordinate;
72+
73+
/**
74+
* Returns YES if |other| overlaps with this bounds.
75+
* Two bounds are overlapping if there is at least one coordinate point
76+
* contained by both.
77+
*/
78+
- (BOOL)intersectsBounds:(GMSCoordinateBounds *)other;
79+
80+
@end
81+
82+
GMS_ASSUME_NONNULL_END
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#import <GoogleMapsBase/GMSCompatabilityMacros.h>
2+
#import <GoogleMapsBase/GMSCoordinateBounds.h>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
framework module GoogleMapsBase { umbrella header "GoogleMapsBase.h"
2+
header "GMSCompatabilityMacros.h"
3+
header "GMSCoordinateBounds.h"
4+
export * module * { export * } }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/GooglePlaces
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Headers
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Modules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Resources
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// GMSAddressComponent.h
3+
// Google Places API for iOS
4+
//
5+
// Copyright 2016 Google Inc.
6+
//
7+
// Usage of this SDK is subject to the Google Maps/Google Earth APIs Terms of
8+
// Service: https://developers.google.com/maps/terms
9+
//
10+
11+
#if __has_feature(modules)
12+
@import GoogleMapsBase;
13+
#else
14+
#import <GoogleMapsBase/GoogleMapsBase.h>
15+
#endif
16+
17+
GMS_ASSUME_NONNULL_BEGIN
18+
19+
/**
20+
* Represents a component of an address, e.g., street number, postcode, city, etc.
21+
*/
22+
@interface GMSAddressComponent : NSObject
23+
24+
/**
25+
* Type of the address component. For a list of supported types, see
26+
* https://developers.google.com/places/supported_types#table2. This string will be one of the
27+
* constants defined in GMSPlaceTypes.h.
28+
*/
29+
@property(nonatomic, readonly, copy) NSString *type;
30+
31+
/** Name of the address component, e.g. "Sydney" */
32+
@property(nonatomic, readonly, copy) NSString *name;
33+
34+
@end
35+
36+
GMS_ASSUME_NONNULL_END
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
//
2+
// GMSAutocompleteFetcher.h
3+
// Google Places API for iOS
4+
//
5+
// Copyright 2016 Google Inc.
6+
//
7+
// Usage of this SDK is subject to the Google Maps/Google Earth APIs Terms of
8+
// Service: https://developers.google.com/maps/terms
9+
//
10+
11+
#if __has_feature(modules)
12+
@import GoogleMapsBase;
13+
#else
14+
#import <GoogleMapsBase/GoogleMapsBase.h>
15+
#endif
16+
#if __has_feature(modules)
17+
@import GoogleMapsBase;
18+
#else
19+
#import <GoogleMapsBase/GoogleMapsBase.h>
20+
#endif
21+
#import <GooglePlaces/GMSAutocompleteFilter.h>
22+
23+
@class GMSAutocompletePrediction;
24+
25+
GMS_ASSUME_NONNULL_BEGIN
26+
27+
/**
28+
* Protocol for objects that can receive callbacks from GMSAutocompleteFetcher
29+
*/
30+
@protocol GMSAutocompleteFetcherDelegate <NSObject>
31+
32+
@required
33+
34+
/**
35+
* Called when autocomplete predictions are available.
36+
* @param predictions an array of GMSAutocompletePrediction objects.
37+
*/
38+
- (void)didAutocompleteWithPredictions:(GMS_NSArrayOf(GMSAutocompletePrediction *) *)predictions;
39+
40+
/**
41+
* Called when an autocomplete request returns an error.
42+
* @param error the error that was received.
43+
*/
44+
- (void)didFailAutocompleteWithError:(NSError *)error;
45+
46+
@end
47+
48+
/**
49+
* GMSAutocompleteFetcher is a wrapper around the lower-level autocomplete APIs that encapsulates
50+
* some of the complexity of requesting autocomplete predictions as the user is typing. Calling
51+
* sourceTextHasChanged will generally result in the provided delegate being called with
52+
* autocomplete predictions for the queried text, with the following provisos:
53+
*
54+
* - The fetcher may not necessarily request predictions on every call of sourceTextHasChanged if
55+
* several requests are made within a short amount of time.
56+
* - The delegate will only be called with prediction results if those predictions are for the
57+
* text supplied in the most recent call to sourceTextHasChanged.
58+
*/
59+
@interface GMSAutocompleteFetcher : NSObject
60+
61+
/**
62+
* Initialise the fetcher
63+
* @param bounds The bounds used to bias the results. This is not a hard restrict - places may still
64+
* be returned outside of these bounds. This parameter may be nil.
65+
* @param filter The filter to apply to the results. This parameter may be nil.
66+
*/
67+
- (instancetype)initWithBounds:(GMSCoordinateBounds *GMS_NULLABLE_PTR)bounds
68+
filter:(GMSAutocompleteFilter *GMS_NULLABLE_PTR)filter
69+
NS_DESIGNATED_INITIALIZER;
70+
71+
/** Delegate to be notified with autocomplete prediction results. */
72+
@property(nonatomic, weak) id<GMSAutocompleteFetcherDelegate> GMS_NULLABLE_PTR delegate;
73+
74+
/** Bounds used to bias the autocomplete search (can be nil). */
75+
@property(nonatomic, strong) GMSCoordinateBounds *GMS_NULLABLE_PTR autocompleteBounds;
76+
77+
/** Filter to apply to autocomplete suggestions (can be nil). */
78+
@property(nonatomic, strong) GMSAutocompleteFilter *GMS_NULLABLE_PTR autocompleteFilter;
79+
80+
/**
81+
* Notify the fetcher that the source text to autocomplete has changed.
82+
*
83+
* This method should only be called from the main thread. Calling this method from another thread
84+
* will result in undefined behavior. Calls to |GMSAutocompleteFetcherDelegate| methods will also be
85+
* called on the main thread.
86+
*
87+
* This method is non-blocking.
88+
* @param text The partial text to autocomplete.
89+
*/
90+
- (void)sourceTextHasChanged:(NSString *GMS_NULLABLE_PTR)text;
91+
92+
@end
93+
94+
GMS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)