Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Araujo authored and Gabriel Araujo committed Nov 4, 2017
2 parents a259eaf + e76a6bf commit e8c54b5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 49 deletions.
35 changes: 2 additions & 33 deletions Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,41 +26,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

// set GoogleMaps API Key
if let path = Bundle.main.path(forResource: "key", ofType: "plist"),
let keys = NSDictionary(contentsOfFile: path),
let key = keys["googleMapsAPIKey"] as? String {
GMSServices.provideAPIKey(key)
}

// TODO: Replace with your API Key from https://developers.google.com/maps/documentation/ios-sdk/
GMSServices.provideAPIKey("YOUR-API-KEY")
return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


}

33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ self.view.addSubview(mapView)
```swift
// Camera position

mapView.rx.didChangePosition.asDriver()
.drive(onNext: { print("Did change camera position: \($0)") })
mapView.rx.didChange.asDriver()
.drive(onNext: { print("Did change position: \($0)") })
.disposed(by: disposeBag)

// Marker tapped

mapView.rx.didTapMarker.asDriver()
.drive(onNext: { print("Did tap marker: \($0)") })
mapView.rx.didTapAt.asDriver()
.drive(onNext: { print("Did tap at coordinate: \($0)") })
.disposed(by: disposeBag)

// Update marker icon without storing selection status
// Location update

let s0 = mapView.rx.selectedMarker.asObservable()
let s1 = s0.skip(1)

Observable.zip(s0, s1) { $0 }
.subscribe(onNext: { (prev, cur) in
if let marker = prev { marker.icon = #imageLiteral(resourceName: "marker_normal") }
if let marker = cur { marker.icon = #imageLiteral(resourceName: "marker_selected") }
mapView.rx.myLocation
.subscribe(onNext: { location in
if let l = location {
print("My location: (\(l.coordinate.latitude), \(l.coordinate.longitude))")
} else {
print("My location: nil")
}
})
.disposed(by: disposeBag)

Expand Down Expand Up @@ -117,10 +117,14 @@ mapView.rx.handleMarkerInfoWindow { marker in

```

*Note:* More examples can be found at the example project from this repo!.

## Installation

### CocoaPods

*Note:* Due to the fact Google Maps is delivered as a static library, you must have CocoaPods 1.4.0 installed to install this library.

1. Update your cocoapods `Podfile`:

```ruby
Expand All @@ -133,6 +137,11 @@ mapView.rx.handleMarkerInfoWindow { marker in
pod 'RxGoogleMaps'
```

## Example Project

1. Get your own API Key a key at https://developers.google.com/maps/documentation/ios-sdk/
2. Open the example project and set your API Key in AppDelegate

## Requirements

- Swift 4.0
Expand Down
4 changes: 0 additions & 4 deletions RxGoogleMaps.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
A90F9CC31DAABB5600A3461E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A90F9CC21DAABB5600A3461E /* Assets.xcassets */; };
A90F9CC61DAABB5600A3461E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A90F9CC41DAABB5600A3461E /* LaunchScreen.storyboard */; };
C5B2468C4099994FDD74ED4D /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AEE9272F37DFF9F5256AB1B0 /* Pods_Example.framework */; settings = {ATTRIBUTES = (Required, ); }; };
E5792B801FA4CF1000FA823A /* key.plist in Resources */ = {isa = PBXBuildFile; fileRef = E5792B7F1FA4CF1000FA823A /* key.plist */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -35,7 +34,6 @@
A90F9CC51DAABB5600A3461E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
A90F9CC71DAABB5600A3461E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
AEE9272F37DFF9F5256AB1B0 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E5792B7F1FA4CF1000FA823A /* key.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = key.plist; sourceTree = "<group>"; };
E58C77E01FABF78500521822 /* libRxGoogleMaps.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libRxGoogleMaps.a; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -126,7 +124,6 @@
A90F9CC21DAABB5600A3461E /* Assets.xcassets */,
A90F9CC41DAABB5600A3461E /* LaunchScreen.storyboard */,
A90F9CC71DAABB5600A3461E /* Info.plist */,
E5792B7F1FA4CF1000FA823A /* key.plist */,
);
path = Example;
sourceTree = "<group>";
Expand Down Expand Up @@ -235,7 +232,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E5792B801FA4CF1000FA823A /* key.plist in Resources */,
A90F9CC61DAABB5600A3461E /* LaunchScreen.storyboard in Resources */,
A90F9CC31DAABB5600A3461E /* Assets.xcassets in Resources */,
A90F9CC11DAABB5600A3461E /* Main.storyboard in Resources */,
Expand Down

0 comments on commit e8c54b5

Please sign in to comment.