Skip to content

Commit 66fa4d3

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 66fa4d3

File tree

4 files changed

+360
-0
lines changed

4 files changed

+360
-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: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 77;
7+
objects = {
8+
9+
/* Begin PBXFileReference section */
10+
1F33D7972E9D928F002440DC /* Snippets.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Snippets.app; sourceTree = BUILT_PRODUCTS_DIR; };
11+
/* End PBXFileReference section */
12+
13+
/* Begin PBXFileSystemSynchronizedRootGroup section */
14+
1F33D7992E9D928F002440DC /* Snippets */ = {
15+
isa = PBXFileSystemSynchronizedRootGroup;
16+
exceptions = (
17+
);
18+
path = Snippets;
19+
sourceTree = "<group>";
20+
};
21+
/* End PBXFileSystemSynchronizedRootGroup section */
22+
23+
/* Begin PBXFrameworksBuildPhase section */
24+
1F33D7942E9D928F002440DC /* Frameworks */ = {
25+
isa = PBXFrameworksBuildPhase;
26+
buildActionMask = 2147483647;
27+
files = (
28+
);
29+
runOnlyForDeploymentPostprocessing = 0;
30+
};
31+
/* End PBXFrameworksBuildPhase section */
32+
33+
/* Begin PBXGroup section */
34+
1F33D78E2E9D928F002440DC = {
35+
isa = PBXGroup;
36+
children = (
37+
1F33D7992E9D928F002440DC /* Snippets */,
38+
1F33D7982E9D928F002440DC /* Products */,
39+
);
40+
sourceTree = "<group>";
41+
};
42+
1F33D7982E9D928F002440DC /* Products */ = {
43+
isa = PBXGroup;
44+
children = (
45+
1F33D7972E9D928F002440DC /* Snippets.app */,
46+
);
47+
name = Products;
48+
sourceTree = "<group>";
49+
};
50+
/* End PBXGroup section */
51+
52+
/* Begin PBXNativeTarget section */
53+
1F33D7962E9D928F002440DC /* Snippets */ = {
54+
isa = PBXNativeTarget;
55+
buildConfigurationList = 1F33D7A52E9D9291002440DC /* Build configuration list for PBXNativeTarget "Snippets" */;
56+
buildPhases = (
57+
1F33D7932E9D928F002440DC /* Sources */,
58+
1F33D7942E9D928F002440DC /* Frameworks */,
59+
1F33D7952E9D928F002440DC /* Resources */,
60+
);
61+
buildRules = (
62+
);
63+
dependencies = (
64+
);
65+
fileSystemSynchronizedGroups = (
66+
1F33D7992E9D928F002440DC /* Snippets */,
67+
);
68+
name = Snippets;
69+
productName = Snippets;
70+
productReference = 1F33D7972E9D928F002440DC /* Snippets.app */;
71+
productType = "com.apple.product-type.application";
72+
};
73+
/* End PBXNativeTarget section */
74+
75+
/* Begin PBXProject section */
76+
1F33D78F2E9D928F002440DC /* Project object */ = {
77+
isa = PBXProject;
78+
attributes = {
79+
BuildIndependentTargetsInParallel = 1;
80+
LastSwiftUpdateCheck = 1620;
81+
LastUpgradeCheck = 1620;
82+
TargetAttributes = {
83+
1F33D7962E9D928F002440DC = {
84+
CreatedOnToolsVersion = 16.2;
85+
};
86+
};
87+
};
88+
buildConfigurationList = 1F33D7922E9D928F002440DC /* Build configuration list for PBXProject "Snippets" */;
89+
developmentRegion = en;
90+
hasScannedForEncodings = 0;
91+
knownRegions = (
92+
en,
93+
Base,
94+
);
95+
mainGroup = 1F33D78E2E9D928F002440DC;
96+
minimizedProjectReferenceProxies = 1;
97+
preferredProjectObjectVersion = 77;
98+
productRefGroup = 1F33D7982E9D928F002440DC /* Products */;
99+
projectDirPath = "";
100+
projectRoot = "";
101+
targets = (
102+
1F33D7962E9D928F002440DC /* Snippets */,
103+
);
104+
};
105+
/* End PBXProject section */
106+
107+
/* Begin PBXResourcesBuildPhase section */
108+
1F33D7952E9D928F002440DC /* Resources */ = {
109+
isa = PBXResourcesBuildPhase;
110+
buildActionMask = 2147483647;
111+
files = (
112+
);
113+
runOnlyForDeploymentPostprocessing = 0;
114+
};
115+
/* End PBXResourcesBuildPhase section */
116+
117+
/* Begin PBXSourcesBuildPhase section */
118+
1F33D7932E9D928F002440DC /* Sources */ = {
119+
isa = PBXSourcesBuildPhase;
120+
buildActionMask = 2147483647;
121+
files = (
122+
);
123+
runOnlyForDeploymentPostprocessing = 0;
124+
};
125+
/* End PBXSourcesBuildPhase section */
126+
127+
/* Begin XCBuildConfiguration section */
128+
1F33D7A32E9D9291002440DC /* Debug */ = {
129+
isa = XCBuildConfiguration;
130+
buildSettings = {
131+
ALWAYS_SEARCH_USER_PATHS = NO;
132+
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
133+
CLANG_ANALYZER_NONNULL = YES;
134+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
135+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
136+
CLANG_ENABLE_MODULES = YES;
137+
CLANG_ENABLE_OBJC_ARC = YES;
138+
CLANG_ENABLE_OBJC_WEAK = YES;
139+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
140+
CLANG_WARN_BOOL_CONVERSION = YES;
141+
CLANG_WARN_COMMA = YES;
142+
CLANG_WARN_CONSTANT_CONVERSION = YES;
143+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
144+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
145+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
146+
CLANG_WARN_EMPTY_BODY = YES;
147+
CLANG_WARN_ENUM_CONVERSION = YES;
148+
CLANG_WARN_INFINITE_RECURSION = YES;
149+
CLANG_WARN_INT_CONVERSION = YES;
150+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
151+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
152+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
153+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
154+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
155+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
156+
CLANG_WARN_STRICT_PROTOTYPES = YES;
157+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
158+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
159+
CLANG_WARN_UNREACHABLE_CODE = YES;
160+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
161+
COPY_PHASE_STRIP = NO;
162+
DEBUG_INFORMATION_FORMAT = dwarf;
163+
ENABLE_STRICT_OBJC_MSGSEND = YES;
164+
ENABLE_TESTABILITY = YES;
165+
ENABLE_USER_SCRIPT_SANDBOXING = YES;
166+
GCC_C_LANGUAGE_STANDARD = gnu17;
167+
GCC_DYNAMIC_NO_PIC = NO;
168+
GCC_NO_COMMON_BLOCKS = YES;
169+
GCC_OPTIMIZATION_LEVEL = 0;
170+
GCC_PREPROCESSOR_DEFINITIONS = (
171+
"DEBUG=1",
172+
"$(inherited)",
173+
);
174+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
175+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
176+
GCC_WARN_UNDECLARED_SELECTOR = YES;
177+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
178+
GCC_WARN_UNUSED_FUNCTION = YES;
179+
GCC_WARN_UNUSED_VARIABLE = YES;
180+
IPHONEOS_DEPLOYMENT_TARGET = 18.2;
181+
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
182+
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
183+
MTL_FAST_MATH = YES;
184+
ONLY_ACTIVE_ARCH = YES;
185+
SDKROOT = iphoneos;
186+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
187+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
188+
};
189+
name = Debug;
190+
};
191+
1F33D7A42E9D9291002440DC /* Release */ = {
192+
isa = XCBuildConfiguration;
193+
buildSettings = {
194+
ALWAYS_SEARCH_USER_PATHS = NO;
195+
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
196+
CLANG_ANALYZER_NONNULL = YES;
197+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
198+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
199+
CLANG_ENABLE_MODULES = YES;
200+
CLANG_ENABLE_OBJC_ARC = YES;
201+
CLANG_ENABLE_OBJC_WEAK = YES;
202+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
203+
CLANG_WARN_BOOL_CONVERSION = YES;
204+
CLANG_WARN_COMMA = YES;
205+
CLANG_WARN_CONSTANT_CONVERSION = YES;
206+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
207+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
208+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
209+
CLANG_WARN_EMPTY_BODY = YES;
210+
CLANG_WARN_ENUM_CONVERSION = YES;
211+
CLANG_WARN_INFINITE_RECURSION = YES;
212+
CLANG_WARN_INT_CONVERSION = YES;
213+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
214+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
215+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
216+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
217+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
218+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
219+
CLANG_WARN_STRICT_PROTOTYPES = YES;
220+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
221+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
222+
CLANG_WARN_UNREACHABLE_CODE = YES;
223+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
224+
COPY_PHASE_STRIP = NO;
225+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
226+
ENABLE_NS_ASSERTIONS = NO;
227+
ENABLE_STRICT_OBJC_MSGSEND = YES;
228+
ENABLE_USER_SCRIPT_SANDBOXING = YES;
229+
GCC_C_LANGUAGE_STANDARD = gnu17;
230+
GCC_NO_COMMON_BLOCKS = YES;
231+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
232+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
233+
GCC_WARN_UNDECLARED_SELECTOR = YES;
234+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
235+
GCC_WARN_UNUSED_FUNCTION = YES;
236+
GCC_WARN_UNUSED_VARIABLE = YES;
237+
IPHONEOS_DEPLOYMENT_TARGET = 18.2;
238+
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
239+
MTL_ENABLE_DEBUG_INFO = NO;
240+
MTL_FAST_MATH = YES;
241+
SDKROOT = iphoneos;
242+
SWIFT_COMPILATION_MODE = wholemodule;
243+
VALIDATE_PRODUCT = YES;
244+
};
245+
name = Release;
246+
};
247+
1F33D7A62E9D9291002440DC /* Debug */ = {
248+
isa = XCBuildConfiguration;
249+
buildSettings = {
250+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
251+
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
252+
CODE_SIGN_STYLE = Automatic;
253+
CURRENT_PROJECT_VERSION = 1;
254+
DEVELOPMENT_ASSET_PATHS = "\"Snippets/Preview Content\"";
255+
ENABLE_PREVIEWS = YES;
256+
GENERATE_INFOPLIST_FILE = YES;
257+
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
258+
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
259+
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
260+
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
261+
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
262+
LD_RUNPATH_SEARCH_PATHS = (
263+
"$(inherited)",
264+
"@executable_path/Frameworks",
265+
);
266+
MARKETING_VERSION = 1.0;
267+
PRODUCT_BUNDLE_IDENTIFIER = Google.Snippets;
268+
PRODUCT_NAME = "$(TARGET_NAME)";
269+
SWIFT_EMIT_LOC_STRINGS = YES;
270+
SWIFT_VERSION = 5.0;
271+
TARGETED_DEVICE_FAMILY = "1,2";
272+
};
273+
name = Debug;
274+
};
275+
1F33D7A72E9D9291002440DC /* Release */ = {
276+
isa = XCBuildConfiguration;
277+
buildSettings = {
278+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
279+
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
280+
CODE_SIGN_STYLE = Automatic;
281+
CURRENT_PROJECT_VERSION = 1;
282+
DEVELOPMENT_ASSET_PATHS = "\"Snippets/Preview Content\"";
283+
ENABLE_PREVIEWS = YES;
284+
GENERATE_INFOPLIST_FILE = YES;
285+
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
286+
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
287+
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
288+
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
289+
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
290+
LD_RUNPATH_SEARCH_PATHS = (
291+
"$(inherited)",
292+
"@executable_path/Frameworks",
293+
);
294+
MARKETING_VERSION = 1.0;
295+
PRODUCT_BUNDLE_IDENTIFIER = Google.Snippets;
296+
PRODUCT_NAME = "$(TARGET_NAME)";
297+
SWIFT_EMIT_LOC_STRINGS = YES;
298+
SWIFT_VERSION = 5.0;
299+
TARGETED_DEVICE_FAMILY = "1,2";
300+
};
301+
name = Release;
302+
};
303+
/* End XCBuildConfiguration section */
304+
305+
/* Begin XCConfigurationList section */
306+
1F33D7922E9D928F002440DC /* Build configuration list for PBXProject "Snippets" */ = {
307+
isa = XCConfigurationList;
308+
buildConfigurations = (
309+
1F33D7A32E9D9291002440DC /* Debug */,
310+
1F33D7A42E9D9291002440DC /* Release */,
311+
);
312+
defaultConfigurationIsVisible = 0;
313+
defaultConfigurationName = Release;
314+
};
315+
1F33D7A52E9D9291002440DC /* Build configuration list for PBXNativeTarget "Snippets" */ = {
316+
isa = XCConfigurationList;
317+
buildConfigurations = (
318+
1F33D7A62E9D9291002440DC /* Debug */,
319+
1F33D7A72E9D9291002440DC /* Release */,
320+
);
321+
defaultConfigurationIsVisible = 0;
322+
defaultConfigurationName = Release;
323+
};
324+
/* End XCConfigurationList section */
325+
};
326+
rootObject = 1F33D78F2E9D928F002440DC /* Project object */;
327+
}
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: IMAStreamRequests) {
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)