Skip to content

Commit

Permalink
Swift 6 compatibility to Swift samples
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 705568273
  • Loading branch information
Justin Malandruccolo authored and copybara-github committed Dec 12, 2024
1 parent f52b944 commit 336407c
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 37 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ jobs:
strategy:
fail-fast: false
matrix:
regex:
- "Objective-C/advanced"
- "Swift/advanced"
- "Objective-C/admob"
- "Swift/admob"
- "Objective-C/admanager"
- "Swift/admanager"
include:
- { regex: "Objective-C/advanced", xcode_version: "15.3" }
- { regex: "Swift/advanced", xcode_version: "16.0" }
- { regex: "Objective-C/admob", xcode_version: "15.3" }
- { regex: "Swift/admob", xcode_version: "16.0" }
- { regex: "Objective-C/admanager", xcode_version: "15.3" }
- { regex: "Swift/admanager", xcode_version: "16.0" }
steps:
- name: Clone Repo
uses: actions/checkout@v1

- name: Select the Google Mobile Ads SDK minimum Xcode version (15.3)
- name:
# Available Xcode versions:
# https://github.com/actions/runner-images/blob/main/images/macos/toolsets/toolset-14.json
run: |
sudo xcode-select -s /Applications/Xcode_15.3.app/Contents/Developer
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer
echo "Selected Xcode version:"
/usr/bin/xcodebuild -version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.ads.AppOpenExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -358,7 +358,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.ads.AppOpenExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import UserMessagingPlatform
/// IAB Certified consent management platform) as one solution to capture
/// consent for users in GDPR impacted countries. This is an example and
/// you can choose another consent management platform to capture consent.

@MainActor
class GoogleMobileAdsConsentManager: NSObject {
static let shared = GoogleMobileAdsConsentManager()

Expand Down Expand Up @@ -54,7 +54,7 @@ class GoogleMobileAdsConsentManager: NSObject {
return consentGatheringComplete(requestConsentError)
}

Task { @MainActor in
Task {
do {
try await UMPConsentForm.loadAndPresentIfRequired(from: viewController)
// Consent has been gathered.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.ads.BannerExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
};
name = Debug;
};
Expand All @@ -311,7 +311,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.ads.BannerExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import UserMessagingPlatform
/// IAB Certified consent management platform) as one solution to capture
/// consent for users in GDPR impacted countries. This is an example and
/// you can choose another consent management platform to capture consent.

@MainActor
class GoogleMobileAdsConsentManager: NSObject {
static let shared = GoogleMobileAdsConsentManager()

Expand Down Expand Up @@ -56,7 +56,7 @@ class GoogleMobileAdsConsentManager: NSObject {
return consentGatheringComplete(requestConsentError)
}

Task { @MainActor in
Task {
do {
// [START load_and_present_consent_form]
try await UMPConsentForm.loadAndPresentIfRequired(from: viewController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.google.ads.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
};
name = Debug;
};
Expand All @@ -312,7 +312,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.google.ads.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import UserMessagingPlatform
/// IAB Certified consent management platform) as one solution to capture
/// consent for users in GDPR impacted countries. This is an example and
/// you can choose another consent management platform to capture consent.

@MainActor
class GoogleMobileAdsConsentManager: NSObject {
static let shared = GoogleMobileAdsConsentManager()

Expand Down Expand Up @@ -54,7 +54,7 @@ class GoogleMobileAdsConsentManager: NSObject {
return consentGatheringComplete(requestConsentError)
}

Task { @MainActor in
Task {
do {
try await UMPConsentForm.loadAndPresentIfRequired(from: viewController)
// Consent has been gathered.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.NativeAdvancedExample;
PRODUCT_NAME = NativeAdvancedExample;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -314,7 +314,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.NativeAdvancedExample;
PRODUCT_NAME = NativeAdvancedExample;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import UserMessagingPlatform
/// IAB Certified consent management platform) as one solution to capture
/// consent for users in GDPR impacted countries. This is an example and
/// you can choose another consent management platform to capture consent.

@MainActor
class GoogleMobileAdsConsentManager: NSObject {
static let shared = GoogleMobileAdsConsentManager()

Expand Down Expand Up @@ -54,7 +54,7 @@ class GoogleMobileAdsConsentManager: NSObject {
return consentGatheringComplete(requestConsentError)
}

Task { @MainActor in
Task {
do {
try await UMPConsentForm.loadAndPresentIfRequired(from: viewController)
// Consent has been gathered.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,21 @@ class ViewController: UIViewController {
}
}

extension ViewController: GADVideoControllerDelegate {
extension ViewController: @preconcurrency GADVideoControllerDelegate {

func videoControllerDidEndVideoPlayback(_ videoController: GADVideoController) {
videoStatusLabel.text = "Video playback has ended."
}
}

extension ViewController: GADAdLoaderDelegate {
extension ViewController: @preconcurrency GADAdLoaderDelegate {
func adLoader(_ adLoader: GADAdLoader, didFailToReceiveAdWithError error: Error) {
print("\(adLoader) failed with error: \(error.localizedDescription)")
refreshAdButton.isEnabled = true
}
}

extension ViewController: GADNativeAdLoaderDelegate {
extension ViewController: @preconcurrency GADNativeAdLoaderDelegate {

func adLoader(_ adLoader: GADAdLoader, didReceive nativeAd: GADNativeAd) {
refreshAdButton.isEnabled = true
Expand Down Expand Up @@ -273,7 +273,7 @@ extension ViewController: GADNativeAdLoaderDelegate {
}

// MARK: - GADNativeAdDelegate implementation
extension ViewController: GADNativeAdDelegate {
extension ViewController: @preconcurrency GADNativeAdDelegate {

func nativeAdDidRecordClick(_ nativeAd: GADNativeAd) {
print("\(#function) called")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.ads.RewardedInterstitialExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
};
name = Debug;
};
Expand All @@ -334,7 +334,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.ads.RewardedInterstitialExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import UserMessagingPlatform
/// IAB Certified consent management platform) as one solution to capture
/// consent for users in GDPR impacted countries. This is an example and
/// you can choose another consent management platform to capture consent.

@MainActor
class GoogleMobileAdsConsentManager: NSObject {
static let shared = GoogleMobileAdsConsentManager()

Expand Down Expand Up @@ -54,7 +54,7 @@ class GoogleMobileAdsConsentManager: NSObject {
return consentGatheringComplete(requestConsentError)
}

Task { @MainActor in
Task {
do {
try await UMPConsentForm.loadAndPresentIfRequired(from: viewController)
// Consent has been gathered.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.ads.RewardedVideoExample;
PRODUCT_NAME = RewardedVideoExample;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
};
name = Debug;
};
Expand All @@ -310,7 +310,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.google.ads.RewardedVideoExample;
PRODUCT_NAME = RewardedVideoExample;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import UserMessagingPlatform
/// IAB Certified consent management platform) as one solution to capture
/// consent for users in GDPR impacted countries. This is an example and
/// you can choose another consent management platform to capture consent.

@MainActor
class GoogleMobileAdsConsentManager: NSObject {
static let shared = GoogleMobileAdsConsentManager()

Expand Down Expand Up @@ -54,7 +54,7 @@ class GoogleMobileAdsConsentManager: NSObject {
return consentGatheringComplete(requestConsentError)
}

Task { @MainActor in
Task {
do {
try await UMPConsentForm.loadAndPresentIfRequired(from: viewController)
// Consent has been gathered.
Expand Down

0 comments on commit 336407c

Please sign in to comment.