Skip to content

Commit c71c11e

Browse files
google-ima-devrel-botIMA Developer Relations
authored andcommitted
Adds a Swift Snippets sample app for IMA documentation code snippets.
- Adds secure signals snippet to the Snippets app. PiperOrigin-RevId: 813387605
1 parent 43680ab commit c71c11e

File tree

5 files changed

+384
-0
lines changed

5 files changed

+384
-0
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
- "Swift/BasicExample"
2929
- "Swift/PodServingExample"
3030
- "Swift/SampleVideoPlayer"
31+
- "Swift/Snippets"
3132
- "Swift/VideoStitcherExample"
3233
- "Swift/SGAIClientSideExample"
3334
steps:

Swift/Snippets/Podfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
platform :ios, '17'
2+
project 'Snippets.xcodeproj'
3+
4+
target 'Snippets' do
5+
pod 'GoogleAds-IMA-iOS-SDK', '~> 3.27.4'
6+
end
Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 56;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
1FF1DF922E8C69B4002D6E45 /* SecureSignalsSnippet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FF1DF912E8C69AA002D6E45 /* SecureSignalsSnippet.swift */; };
11+
/* End PBXBuildFile section */
12+
13+
/* Begin PBXFileReference section */
14+
1FF1DF912E8C69AA002D6E45 /* SecureSignalsSnippet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureSignalsSnippet.swift; sourceTree = "<group>"; };
15+
/* End PBXFileReference section */
16+
17+
/* Begin PBXFrameworksBuildPhase section */
18+
D216278D2C165053004B08EF /* Frameworks */ = {
19+
isa = PBXFrameworksBuildPhase;
20+
buildActionMask = 2147483647;
21+
files = (
22+
);
23+
runOnlyForDeploymentPostprocessing = 0;
24+
};
25+
/* End PBXFrameworksBuildPhase section */
26+
27+
/* Begin PBXGroup section */
28+
C3F09BE363D05255D29BD1ED /* Pods */ = {
29+
isa = PBXGroup;
30+
children = (
31+
);
32+
path = Pods;
33+
sourceTree = "<group>";
34+
};
35+
D21627872C165053004B08EF = {
36+
isa = PBXGroup;
37+
children = (
38+
D21627922C165053004B08EF /* Snippets */,
39+
D21627912C165053004B08EF /* Products */,
40+
C3F09BE363D05255D29BD1ED /* Pods */,
41+
);
42+
sourceTree = "<group>";
43+
};
44+
D21627912C165053004B08EF /* Products */ = {
45+
isa = PBXGroup;
46+
children = (
47+
);
48+
name = Products;
49+
sourceTree = "<group>";
50+
};
51+
D21627922C165053004B08EF /* Snippets */ = {
52+
isa = PBXGroup;
53+
children = (
54+
1FF1DF912E8C69AA002D6E45 /* SecureSignalsSnippet.swift */,
55+
);
56+
name = Snippets;
57+
path = app;
58+
sourceTree = "<group>";
59+
};
60+
/* End PBXGroup section */
61+
62+
/* Begin PBXNativeTarget section */
63+
D216278F2C165053004B08EF /* Snippets */ = {
64+
isa = PBXNativeTarget;
65+
buildConfigurationList = D21627A72C165055004B08EF /* Build configuration list for PBXNativeTarget "Snippets" */;
66+
buildPhases = (
67+
D216278C2C165053004B08EF /* Sources */,
68+
D216278D2C165053004B08EF /* Frameworks */,
69+
);
70+
buildRules = (
71+
);
72+
dependencies = (
73+
);
74+
name = Snippets;
75+
productName = Snippets;
76+
productType = "com.apple.product-type.application";
77+
};
78+
/* End PBXNativeTarget section */
79+
80+
/* Begin PBXProject section */
81+
D21627882C165053004B08EF /* Project object */ = {
82+
isa = PBXProject;
83+
attributes = {
84+
BuildIndependentTargetsInParallel = 1;
85+
LastSwiftUpdateCheck = 1530;
86+
LastUpgradeCheck = 1530;
87+
TargetAttributes = {
88+
D216278F2C165053004B08EF = {
89+
CreatedOnToolsVersion = 15.3;
90+
};
91+
};
92+
};
93+
buildConfigurationList = D216278B2C165053004B08EF /* Build configuration list for PBXProject "Snippets" */;
94+
compatibilityVersion = "Xcode 14.0";
95+
developmentRegion = en;
96+
hasScannedForEncodings = 0;
97+
knownRegions = (
98+
en,
99+
Base,
100+
);
101+
mainGroup = D21627872C165053004B08EF;
102+
productRefGroup = D21627912C165053004B08EF /* Products */;
103+
projectDirPath = "";
104+
projectRoot = "";
105+
targets = (
106+
D216278F2C165053004B08EF /* Snippets */,
107+
);
108+
};
109+
/* End PBXProject section */
110+
111+
/* Begin PBXSourcesBuildPhase section */
112+
D216278C2C165053004B08EF /* Sources */ = {
113+
isa = PBXSourcesBuildPhase;
114+
buildActionMask = 2147483647;
115+
files = (
116+
1FF1DF922E8C69B4002D6E45 /* SecureSignalsSnippet.swift in Sources */,
117+
);
118+
runOnlyForDeploymentPostprocessing = 0;
119+
};
120+
/* End PBXSourcesBuildPhase section */
121+
122+
/* Begin XCBuildConfiguration section */
123+
D21627A52C165055004B08EF /* Debug */ = {
124+
isa = XCBuildConfiguration;
125+
buildSettings = {
126+
ALWAYS_SEARCH_USER_PATHS = NO;
127+
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
128+
CLANG_ANALYZER_NONNULL = YES;
129+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
130+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
131+
CLANG_ENABLE_MODULES = YES;
132+
CLANG_ENABLE_OBJC_ARC = YES;
133+
CLANG_ENABLE_OBJC_WEAK = YES;
134+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
135+
CLANG_WARN_BOOL_CONVERSION = YES;
136+
CLANG_WARN_COMMA = YES;
137+
CLANG_WARN_CONSTANT_CONVERSION = YES;
138+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
139+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
140+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
141+
CLANG_WARN_EMPTY_BODY = YES;
142+
CLANG_WARN_ENUM_CONVERSION = YES;
143+
CLANG_WARN_INFINITE_RECURSION = YES;
144+
CLANG_WARN_INT_CONVERSION = YES;
145+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
146+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
147+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
148+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
149+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
150+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
151+
CLANG_WARN_STRICT_PROTOTYPES = YES;
152+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
153+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
154+
CLANG_WARN_UNREACHABLE_CODE = YES;
155+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
156+
COPY_PHASE_STRIP = NO;
157+
DEBUG_INFORMATION_FORMAT = dwarf;
158+
ENABLE_STRICT_OBJC_MSGSEND = YES;
159+
ENABLE_TESTABILITY = YES;
160+
ENABLE_USER_SCRIPT_SANDBOXING = NO;
161+
GCC_C_LANGUAGE_STANDARD = gnu17;
162+
GCC_DYNAMIC_NO_PIC = NO;
163+
GCC_NO_COMMON_BLOCKS = YES;
164+
GCC_OPTIMIZATION_LEVEL = 0;
165+
GCC_PREPROCESSOR_DEFINITIONS = (
166+
"DEBUG=1",
167+
"$(inherited)",
168+
);
169+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
170+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
171+
GCC_WARN_UNDECLARED_SELECTOR = YES;
172+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
173+
GCC_WARN_UNUSED_FUNCTION = YES;
174+
GCC_WARN_UNUSED_VARIABLE = YES;
175+
IPHONEOS_DEPLOYMENT_TARGET = 17.4;
176+
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
177+
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
178+
MTL_FAST_MATH = YES;
179+
ONLY_ACTIVE_ARCH = YES;
180+
SDKROOT = iphoneos;
181+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
182+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
183+
};
184+
name = Debug;
185+
};
186+
D21627A62C165055004B08EF /* Release */ = {
187+
isa = XCBuildConfiguration;
188+
buildSettings = {
189+
ALWAYS_SEARCH_USER_PATHS = NO;
190+
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
191+
CLANG_ANALYZER_NONNULL = YES;
192+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
193+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
194+
CLANG_ENABLE_MODULES = YES;
195+
CLANG_ENABLE_OBJC_ARC = YES;
196+
CLANG_ENABLE_OBJC_WEAK = YES;
197+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
198+
CLANG_WARN_BOOL_CONVERSION = YES;
199+
CLANG_WARN_COMMA = YES;
200+
CLANG_WARN_CONSTANT_CONVERSION = YES;
201+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
202+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
203+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
204+
CLANG_WARN_EMPTY_BODY = YES;
205+
CLANG_WARN_ENUM_CONVERSION = YES;
206+
CLANG_WARN_INFINITE_RECURSION = YES;
207+
CLANG_WARN_INT_CONVERSION = YES;
208+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
209+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
210+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
211+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
212+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
213+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
214+
CLANG_WARN_STRICT_PROTOTYPES = YES;
215+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
216+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
217+
CLANG_WARN_UNREACHABLE_CODE = YES;
218+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
219+
COPY_PHASE_STRIP = NO;
220+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
221+
ENABLE_NS_ASSERTIONS = NO;
222+
ENABLE_STRICT_OBJC_MSGSEND = YES;
223+
ENABLE_USER_SCRIPT_SANDBOXING = NO;
224+
GCC_C_LANGUAGE_STANDARD = gnu17;
225+
GCC_NO_COMMON_BLOCKS = YES;
226+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
227+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
228+
GCC_WARN_UNDECLARED_SELECTOR = YES;
229+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
230+
GCC_WARN_UNUSED_FUNCTION = YES;
231+
GCC_WARN_UNUSED_VARIABLE = YES;
232+
IPHONEOS_DEPLOYMENT_TARGET = 17.4;
233+
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
234+
MTL_ENABLE_DEBUG_INFO = NO;
235+
MTL_FAST_MATH = YES;
236+
SDKROOT = iphoneos;
237+
SWIFT_COMPILATION_MODE = wholemodule;
238+
VALIDATE_PRODUCT = YES;
239+
};
240+
name = Release;
241+
};
242+
/* End XCBuildConfiguration section */
243+
244+
/* Begin XCConfigurationList section */
245+
D216278B2C165053004B08EF /* Build configuration list for PBXProject "Snippets" */ = {
246+
isa = XCConfigurationList;
247+
buildConfigurations = (
248+
D21627A52C165055004B08EF /* Debug */,
249+
D21627A62C165055004B08EF /* Release */,
250+
);
251+
defaultConfigurationIsVisible = 0;
252+
defaultConfigurationName = Release;
253+
};
254+
D21627A72C165055004B08EF /* Build configuration list for PBXNativeTarget "Snippets" */ = {
255+
isa = XCConfigurationList;
256+
buildConfigurations = (
257+
D21627A82C165055004B08EF /* Debug */,
258+
D21627A92C165055004B08EF /* Release */,
259+
);
260+
defaultConfigurationIsVisible = 0;
261+
defaultConfigurationName = Release;
262+
};
263+
/* End XCConfigurationList section */
264+
};
265+
rootObject = D21627882C165053004B08EF /* Project object */;
266+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1530"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES"
8+
buildArchitectures = "Automatic">
9+
<BuildActionEntries>
10+
<BuildActionEntry
11+
buildForTesting = "YES"
12+
buildForRunning = "YES"
13+
buildForProfiling = "YES"
14+
buildForArchiving = "YES"
15+
buildForAnalyzing = "YES">
16+
<BuildableReference
17+
BuildableIdentifier = "primary"
18+
BlueprintIdentifier = "D216278F2C165053004B08EF"
19+
BuildableName = "Snippets"
20+
BlueprintName = "Snippets"
21+
ReferencedContainer = "container:Snippets.xcodeproj">
22+
</BuildableReference>
23+
</BuildActionEntry>
24+
</BuildActionEntries>
25+
</BuildAction>
26+
<TestAction
27+
buildConfiguration = "Debug"
28+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
29+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
30+
shouldUseLaunchSchemeArgsEnv = "YES"
31+
shouldAutocreateTestPlan = "YES">
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "D216278F2C165053004B08EF"
48+
BuildableName = "Snippets"
49+
BlueprintName = "Snippets"
50+
ReferencedContainer = "container:Snippets.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
<EnvironmentVariables>
54+
<EnvironmentVariable
55+
key = "IDEPreferLogStreaming"
56+
value = "YES"
57+
isEnabled = "YES">
58+
</EnvironmentVariable>
59+
</EnvironmentVariables>
60+
</LaunchAction>
61+
<ProfileAction
62+
buildConfiguration = "Release"
63+
shouldUseLaunchSchemeArgsEnv = "YES"
64+
savedToolIdentifier = ""
65+
useCustomWorkingDirectory = "NO"
66+
debugDocumentVersioning = "YES">
67+
<BuildableProductRunnable
68+
runnableDebuggingMode = "0">
69+
<BuildableReference
70+
BuildableIdentifier = "primary"
71+
BlueprintIdentifier = "D216278F2C165053004B08EF"
72+
BuildableName = "Snippets"
73+
BlueprintName = "Snippets"
74+
ReferencedContainer = "container:Snippets.xcodeproj">
75+
</BuildableReference>
76+
</BuildableProductRunnable>
77+
</ProfileAction>
78+
<AnalyzeAction
79+
buildConfiguration = "Debug">
80+
</AnalyzeAction>
81+
<ArchiveAction
82+
buildConfiguration = "Release"
83+
revealArchiveInOrganizer = "YES">
84+
</ArchiveAction>
85+
</Scheme>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2025 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 GoogleInteractiveMediaAds
15+
16+
/// IMA iOS SDK - Secure Signals
17+
/// Demonstrates setting an encoded secure signal string on your stream request.
18+
class SecureSignalsSnippet: NSObject {
19+
20+
func setSecureSignals(streamRequest: IMAStreamRequest) {
21+
// [START make_secure_signals_stream_request]
22+
let signals = IMASecureSignals(customData: "My encoded signal string")
23+
streamRequest.secureSignals = signals
24+
// [END make_secure_signals_stream_request]
25+
}
26+
}

0 commit comments

Comments
 (0)