Skip to content

Commit 7150ff2

Browse files
chore: Update Maps and Places samples to 7.4.0 (#167)
* chore: Update Maps and Places samples from CocoaPods * chore: update snippets and tutorials to 7.4.0 --------- Co-authored-by: Angela Yu <[email protected]>
1 parent 27581e8 commit 7150ff2

File tree

49 files changed

+1157
-774
lines changed

Some content is hidden

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

49 files changed

+1157
-774
lines changed

GoogleMaps-Swift/GoogleMapsSwiftDemos.xcodeproj/project.pbxproj

Lines changed: 126 additions & 122 deletions
Large diffs are not rendered by default.

GoogleMaps-Swift/GoogleMapsSwiftDemos/Swift/AppDelegate.swift

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ import GoogleMaps
1515
import UIKit
1616

1717
@UIApplicationMain
18-
class AppDelegate: UIResponder, UIApplicationDelegate {
19-
20-
var window: UIWindow?
18+
class AppDelegate: UIResponder, UIApplicationDelegate, UIWindowSceneDelegate {
2119

2220
func application(
2321
_ application: UIApplication,
@@ -28,22 +26,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2826
// Metal is the preferred renderer.
2927
GMSServices.setMetalRendererEnabled(true)
3028

31-
// On iOS 15, continue to use opaque navigation bars like earlier iOS versions.
32-
if #available(iOS 15.0, *) {
33-
let navBarAppearance = UINavigationBarAppearance()
34-
navBarAppearance.configureWithOpaqueBackground()
35-
UINavigationBar.appearance().standardAppearance = navBarAppearance
36-
UINavigationBar.appearance().scrollEdgeAppearance = navBarAppearance
37-
}
38-
39-
let sampleListViewController = SampleListViewController()
40-
let frame = UIScreen.main.bounds
41-
let window = UIWindow(frame: frame)
42-
let navigationController = UINavigationController(rootViewController: sampleListViewController)
43-
window.rootViewController = navigationController
44-
window.makeKeyAndVisible()
45-
self.window = window
46-
4729
return true
4830
}
31+
32+
func application(
33+
_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession,
34+
options: UIScene.ConnectionOptions
35+
) -> UISceneConfiguration {
36+
let config = UISceneConfiguration(
37+
name: "Default configuration", sessionRole: connectingSceneSession.role)
38+
config.delegateClass = SceneDelegate.self
39+
return config
40+
}
4941
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2022 Google LLC. All rights reserved.
2+
//
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
5+
// file except in compliance with the License. You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software distributed under
10+
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
// ANY KIND, either express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
13+
14+
import UIKit
15+
16+
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
17+
18+
var window: UIWindow?
19+
20+
func scene(
21+
_ scene: UIScene, willConnectTo session: UISceneSession,
22+
options connectionOptions: UIScene.ConnectionOptions
23+
) {
24+
guard let scene = scene as? UIWindowScene else { return }
25+
window = .init(windowScene: scene)
26+
27+
// On iOS 15, continue to use opaque navigation bars like earlier iOS versions.
28+
if #available(iOS 15.0, *) {
29+
let navBarAppearance = UINavigationBarAppearance()
30+
navBarAppearance.configureWithOpaqueBackground()
31+
UINavigationBar.appearance().standardAppearance = navBarAppearance
32+
UINavigationBar.appearance().scrollEdgeAppearance = navBarAppearance
33+
}
34+
35+
let sampleListViewController = SampleListViewController()
36+
let navigationController = UINavigationController(rootViewController: sampleListViewController)
37+
window?.rootViewController = navigationController
38+
window?.makeKeyAndVisible()
39+
}
40+
}

GoogleMaps-Swift/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ source 'https://github.com/CocoaPods/Specs.git'
22

33
target 'GoogleMapsSwiftDemos' do
44
platform :ios, '13.0'
5-
pod 'GoogleMaps', '= 7.3.0'
5+
pod 'GoogleMaps', '= 7.4.0'
66
end

GoogleMaps/GoogleMapsDemos.xcodeproj/project.pbxproj

Lines changed: 237 additions & 231 deletions
Large diffs are not rendered by default.

GoogleMaps/GoogleMapsDemos/DemoAppDelegate.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
@interface DemoAppDelegate : UIResponder <UIApplicationDelegate>
1919

20-
@property(nonatomic) UIWindow *window;
21-
@property(nonatomic) UISplitViewController *splitViewController;
22-
@property(nonatomic) id servicesHandle;
20+
@property(nonatomic, nullable) id servicesHandle;
2321

2422
@end

GoogleMaps/GoogleMapsDemos/DemoAppDelegate.m

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@
1515

1616
#import "GoogleMapsDemos/DemoAppDelegate.h"
1717

18-
#import "GoogleMapsDemos/MasterViewController.h"
19-
#import "GoogleMapsDemos/SDKDemoAPIKey.h"
2018
#import <GoogleMaps/GoogleMaps.h>
19+
#import "GoogleMapsDemos/DemoSceneDelegate.h"
20+
#import "GoogleMapsDemos/SDKDemoAPIKey.h"
2121

2222
@implementation DemoAppDelegate
2323

24-
@synthesize window = _window;
25-
2624
- (BOOL)application:(UIApplication *)application
2725
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
2826
NSLog(@"Build version: %s", __VERSION__);
@@ -46,29 +44,17 @@ - (BOOL)application:(UIApplication *)application
4644
// demo.
4745
NSLog(@"Open source licenses:\n%@", [GMSServices openSourceLicenseInfo]);
4846

49-
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
50-
MasterViewController *master = [[MasterViewController alloc] init];
51-
52-
UINavigationController *masterNavigationController =
53-
[[UINavigationController alloc] initWithRootViewController:master];
54-
55-
UIViewController *empty = [[UIViewController alloc] init];
56-
UINavigationController *detailNavigationController =
57-
[[UINavigationController alloc] initWithRootViewController:empty];
58-
59-
self.splitViewController = [[UISplitViewController alloc] init];
60-
self.splitViewController.delegate = master;
61-
self.splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeAllVisible;
62-
self.splitViewController.viewControllers =
63-
@[ masterNavigationController, detailNavigationController ];
64-
65-
empty.navigationItem.leftItemsSupplementBackButton = YES;
66-
empty.navigationItem.leftBarButtonItem = self.splitViewController.displayModeButtonItem;
67-
68-
self.window.rootViewController = self.splitViewController;
69-
70-
[self.window makeKeyAndVisible];
7147
return YES;
7248
}
7349

50+
- (UISceneConfiguration *)application:(UIApplication *)application
51+
configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession
52+
options:(UISceneConnectionOptions *)options {
53+
UISceneConfiguration *configuration =
54+
[UISceneConfiguration configurationWithName:@"Default Configuration"
55+
sessionRole:connectingSceneSession.role];
56+
configuration.delegateClass = [DemoSceneDelegate class];
57+
return configuration;
58+
}
59+
7460
@end
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2022 Google LLC. All rights reserved.
3+
*
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6+
* file except in compliance with the License. You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software distributed under
11+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12+
* ANY KIND, either express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
#import <UIKit/UIKit.h>
17+
18+
NS_ASSUME_NONNULL_BEGIN
19+
20+
@interface DemoSceneDelegate : UIResponder <UIWindowSceneDelegate>
21+
@property(nonatomic, nullable) UIWindow *window;
22+
@property(nonatomic, nullable) UISplitViewController *splitViewController;
23+
@end
24+
25+
NS_ASSUME_NONNULL_END
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2022 Google LLC. All rights reserved.
3+
*
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6+
* file except in compliance with the License. You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software distributed under
11+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12+
* ANY KIND, either express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
#import "GoogleMapsDemos/DemoSceneDelegate.h"
17+
18+
#import "GoogleMapsDemos/SampleListViewController.h"
19+
20+
@implementation DemoSceneDelegate
21+
22+
- (void)scene:(UIScene *)scene
23+
willConnectToSession:(UISceneSession *)session
24+
options:(UISceneConnectionOptions *)connectionOptions {
25+
if (![scene isKindOfClass:[UIWindowScene class]]) {
26+
return;
27+
}
28+
UIWindowScene *windowScene = (UIWindowScene *)scene;
29+
self.window = [[UIWindow alloc] initWithWindowScene:windowScene];
30+
31+
SampleListViewController *sampleListViewController = [[SampleListViewController alloc] init];
32+
33+
UINavigationController *rootNavigationController =
34+
[[UINavigationController alloc] initWithRootViewController:sampleListViewController];
35+
36+
UIViewController *detailController = [[UIViewController alloc] init];
37+
38+
self.splitViewController = [[UISplitViewController alloc] init];
39+
self.splitViewController.delegate = sampleListViewController;
40+
self.splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeAllVisible;
41+
self.splitViewController.viewControllers = @[ rootNavigationController, detailController ];
42+
43+
self.window.rootViewController = self.splitViewController;
44+
[self.window makeKeyAndVisible];
45+
}
46+
47+
@end
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright 2016 Google LLC. All rights reserved.
3+
*
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6+
* file except in compliance with the License. You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software distributed under
11+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12+
* ANY KIND, either express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
#import <UIKit/UIKit.h>
17+
18+
@interface SampleListViewController
19+
: UITableViewController <UISplitViewControllerDelegate, UISearchResultsUpdating>
20+
21+
@end

0 commit comments

Comments
 (0)