Skip to content

Commit b8d819f

Browse files
committed
chore(places-address-form): update to Swift 5.
1 parent 8c592a7 commit b8d819f

File tree

3 files changed

+20
-25
lines changed

3 files changed

+20
-25
lines changed

tutorials/places-address-form/places-address-form.xcodeproj/project.pbxproj

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
E597005C1E1EBE6A0064EC55 /* Sources */,
103103
E597005D1E1EBE6A0064EC55 /* Frameworks */,
104104
E597005E1E1EBE6A0064EC55 /* Resources */,
105-
C517A33332DB18DE450285A9 /* [CP] Embed Pods Frameworks */,
106105
1F6B6DB2ADA6236AB583A518 /* [CP] Copy Pods Resources */,
107106
);
108107
buildRules = (
@@ -127,6 +126,7 @@
127126
E597005F1E1EBE6A0064EC55 = {
128127
CreatedOnToolsVersion = 8.2;
129128
DevelopmentTeam = EQHXZ8M8AV;
129+
LastSwiftMigration = 1130;
130130
ProvisioningStyle = Automatic;
131131
};
132132
};
@@ -136,6 +136,7 @@
136136
developmentRegion = English;
137137
hasScannedForEncodings = 0;
138138
knownRegions = (
139+
English,
139140
en,
140141
Base,
141142
);
@@ -170,13 +171,16 @@
170171
files = (
171172
);
172173
inputPaths = (
174+
"${PODS_ROOT}/Target Support Files/Pods-places-address-form/Pods-places-address-form-resources.sh",
175+
"${PODS_ROOT}/GooglePlaces/Frameworks/GooglePlaces.framework/Resources/GooglePlaces.bundle",
173176
);
174177
name = "[CP] Copy Pods Resources";
175178
outputPaths = (
179+
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GooglePlaces.bundle",
176180
);
177181
runOnlyForDeploymentPostprocessing = 0;
178182
shellPath = /bin/sh;
179-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-places-address-form/Pods-places-address-form-resources.sh\"\n";
183+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-places-address-form/Pods-places-address-form-resources.sh\"\n";
180184
showEnvVarsInLog = 0;
181185
};
182186
47883A2AC57FD568A03BF36F /* [CP] Check Pods Manifest.lock */ = {
@@ -185,28 +189,16 @@
185189
files = (
186190
);
187191
inputPaths = (
192+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
193+
"${PODS_ROOT}/Manifest.lock",
188194
);
189195
name = "[CP] Check Pods Manifest.lock";
190196
outputPaths = (
197+
"$(DERIVED_FILE_DIR)/Pods-places-address-form-checkManifestLockResult.txt",
191198
);
192199
runOnlyForDeploymentPostprocessing = 0;
193200
shellPath = /bin/sh;
194-
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
195-
showEnvVarsInLog = 0;
196-
};
197-
C517A33332DB18DE450285A9 /* [CP] Embed Pods Frameworks */ = {
198-
isa = PBXShellScriptBuildPhase;
199-
buildActionMask = 2147483647;
200-
files = (
201-
);
202-
inputPaths = (
203-
);
204-
name = "[CP] Embed Pods Frameworks";
205-
outputPaths = (
206-
);
207-
runOnlyForDeploymentPostprocessing = 0;
208-
shellPath = /bin/sh;
209-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-places-address-form/Pods-places-address-form-frameworks.sh\"\n";
201+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
210202
showEnvVarsInLog = 0;
211203
};
212204
/* End PBXShellScriptBuildPhase section */
@@ -346,7 +338,8 @@
346338
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
347339
PRODUCT_BUNDLE_IDENTIFIER = "com.google.examples.places-address-form";
348340
PRODUCT_NAME = "$(TARGET_NAME)";
349-
SWIFT_VERSION = 3.0;
341+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
342+
SWIFT_VERSION = 5.0;
350343
};
351344
name = Debug;
352345
};
@@ -360,7 +353,8 @@
360353
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
361354
PRODUCT_BUNDLE_IDENTIFIER = "com.google.examples.places-address-form";
362355
PRODUCT_NAME = "$(TARGET_NAME)";
363-
SWIFT_VERSION = 3.0;
356+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
357+
SWIFT_VERSION = 5.0;
364358
};
365359
name = Release;
366360
};
@@ -383,6 +377,7 @@
383377
E59700741E1EBE6A0064EC55 /* Release */,
384378
);
385379
defaultConfigurationIsVisible = 0;
380+
defaultConfigurationName = Release;
386381
};
387382
/* End XCConfigurationList section */
388383
};

tutorials/places-address-form/places-address-form/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2121

2222
var window: UIWindow?
2323

24-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
24+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
2525
GMSPlacesClient.provideAPIKey("YOUR_API_KEY")
2626
return true
2727
}

tutorials/places-address-form/places-address-form/ViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ extension ViewController: GMSAutocompleteViewControllerDelegate {
7979

8080
// Handle the user's selection.
8181
func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) {
82-
// Print place info to the console.
83-
print("Place name: \(place.name)")
84-
print("Place address: \(place.formattedAddress)")
85-
print("Place attributions: \(place.attributions)")
82+
// Print place info to the console
83+
print("Place name: \(place.name ?? "")")
84+
print("Place address: \(place.formattedAddress ?? "")")
85+
print("Place attributions: \(String(describing: place.attributions))")
8686

8787
// Get the address components.
8888
if let addressLines = place.addressComponents {

0 commit comments

Comments
 (0)