diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj new file mode 100644 index 0000000..cdfcf3a --- /dev/null +++ b/Example/Example.xcodeproj/project.pbxproj @@ -0,0 +1,365 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + B883A4092DAC925400F41C4D /* mParticle-Rokt in Frameworks */ = {isa = PBXBuildFile; productRef = B883A4082DAC925400F41C4D /* mParticle-Rokt */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + B883A3D32DAC923100F41C4D /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + B883A3FB2DAC923300F41C4D /* Exceptions for "Example" folder in "Example" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Resources/Info.plist, + ); + target = B883A3D22DAC923100F41C4D /* Example */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + B883A3D52DAC923100F41C4D /* Example */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + B883A3FB2DAC923300F41C4D /* Exceptions for "Example" folder in "Example" target */, + ); + path = Example; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + B883A3D02DAC923100F41C4D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B883A4092DAC925400F41C4D /* mParticle-Rokt in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + B883A3CA2DAC923100F41C4D = { + isa = PBXGroup; + children = ( + B883A3D52DAC923100F41C4D /* Example */, + B883A3D42DAC923100F41C4D /* Products */, + ); + sourceTree = ""; + }; + B883A3D42DAC923100F41C4D /* Products */ = { + isa = PBXGroup; + children = ( + B883A3D32DAC923100F41C4D /* Example.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + B883A3D22DAC923100F41C4D /* Example */ = { + isa = PBXNativeTarget; + buildConfigurationList = B883A3FC2DAC923300F41C4D /* Build configuration list for PBXNativeTarget "Example" */; + buildPhases = ( + B883A3CF2DAC923100F41C4D /* Sources */, + B883A3D02DAC923100F41C4D /* Frameworks */, + B883A3D12DAC923100F41C4D /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + B883A3D52DAC923100F41C4D /* Example */, + ); + name = Example; + packageProductDependencies = ( + B883A4082DAC925400F41C4D /* mParticle-Rokt */, + ); + productName = Example; + productReference = B883A3D32DAC923100F41C4D /* Example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + B883A3CB2DAC923100F41C4D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1630; + LastUpgradeCheck = 1630; + TargetAttributes = { + B883A3D22DAC923100F41C4D = { + CreatedOnToolsVersion = 16.3; + }; + }; + }; + buildConfigurationList = B883A3CE2DAC923100F41C4D /* Build configuration list for PBXProject "Example" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = B883A3CA2DAC923100F41C4D; + minimizedProjectReferenceProxies = 1; + packageReferences = ( + B883A4072DAC925400F41C4D /* XCLocalSwiftPackageReference "../../mparticle-apple-integration-rokt" */, + ); + preferredProjectObjectVersion = 77; + productRefGroup = B883A3D42DAC923100F41C4D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + B883A3D22DAC923100F41C4D /* Example */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + B883A3D12DAC923100F41C4D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + B883A3CF2DAC923100F41C4D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + B883A3FD2DAC923300F41C4D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = EX8W57PJ9C; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = Example/Resources/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = ""; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.rokt.Example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + B883A3FE2DAC923300F41C4D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = EX8W57PJ9C; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = Example/Resources/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = ""; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.rokt.Example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + B883A3FF2DAC923300F41C4D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = EX8W57PJ9C; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.4; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + B883A4002DAC923300F41C4D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = EX8W57PJ9C; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.4; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B883A3CE2DAC923100F41C4D /* Build configuration list for PBXProject "Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B883A3FF2DAC923300F41C4D /* Debug */, + B883A4002DAC923300F41C4D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B883A3FC2DAC923300F41C4D /* Build configuration list for PBXNativeTarget "Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B883A3FD2DAC923300F41C4D /* Debug */, + B883A3FE2DAC923300F41C4D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + B883A4072DAC925400F41C4D /* XCLocalSwiftPackageReference "../../mparticle-apple-integration-rokt" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = "../../mparticle-apple-integration-rokt"; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + B883A4082DAC925400F41C4D /* mParticle-Rokt */ = { + isa = XCSwiftPackageProductDependency; + productName = "mParticle-Rokt"; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = B883A3CB2DAC923100F41C4D /* Project object */; +} diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme new file mode 100644 index 0000000..9640d75 --- /dev/null +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Example/AppDelegate.swift b/Example/Example/AppDelegate.swift new file mode 100644 index 0000000..addb436 --- /dev/null +++ b/Example/Example/AppDelegate.swift @@ -0,0 +1,21 @@ + +import UIKit +import mParticle_Apple_SDK + +@main +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + + if let key = ProcessInfo.processInfo.environment["MPARTICLE_KEY"], + let secret = ProcessInfo.processInfo.environment["MPARTICLE_SECRET"] { + MParticle.sharedInstance().start(with: MParticleOptions(key: key, secret: secret)) + } + + window = UIWindow() + window?.rootViewController = HomeViewController() + window?.makeKeyAndVisible() + return true + } +} diff --git a/Example/Example/HomeViewController.swift b/Example/Example/HomeViewController.swift new file mode 100644 index 0000000..6612ffa --- /dev/null +++ b/Example/Example/HomeViewController.swift @@ -0,0 +1,169 @@ + +import UIKit +import Rokt_Widget +import mParticle_Apple_SDK + +class HomeViewController: UIViewController { + + private enum Constants { + static let buttonHeight: CGFloat = 50 + static let padding: CGFloat = 32 + } + + private lazy var displayButton: UIButton = { + let button = UIButton() + var configuration = UIButton.Configuration.filled() + configuration.baseBackgroundColor = .appColor + configuration.baseForegroundColor = .white + configuration.buttonSize = .large + configuration.cornerStyle = .capsule + configuration.title = "Show" + button.configuration = configuration + button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside) + button.translatesAutoresizingMaskIntoConstraints = false + return button + }() + + private lazy var stackView: UIStackView = { + let stackView = UIStackView() + stackView.axis = .vertical + stackView.translatesAutoresizingMaskIntoConstraints = false + stackView.distribution = .fill + return stackView + }() + + private lazy var imageView: UIView = { + let containerView = UIView() + + let imageView = UIImageView(image: UIImage(named: "RoktLogo")) + imageView.contentMode = .scaleAspectFit + imageView.translatesAutoresizingMaskIntoConstraints = false + imageView.setContentHuggingPriority(.required, for: .horizontal) + containerView.addSubview(imageView) + + NSLayoutConstraint.activate([ + imageView.leadingAnchor.constraint(greaterThanOrEqualTo: containerView.leadingAnchor), + imageView.trailingAnchor.constraint(lessThanOrEqualTo: containerView.trailingAnchor), + imageView.topAnchor.constraint(equalTo: containerView.topAnchor), + imageView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor), + imageView.centerXAnchor.constraint(equalTo: containerView.centerXAnchor), + imageView.widthAnchor.constraint(equalToConstant: 200) + ]) + return containerView + }() + + private let titleLabel: UILabel = { + let label = UILabel() + label.text = "Seize the Transaction Moment" + label.font = .systemFont(ofSize: 18, weight: .medium) + label.textAlignment = .center + label.textColor = .titleColor + return label + }() + + private let captionLabel: UILabel = { + let label = UILabel() + label.text = "® Rokt 2025 — All rights reserved" + label.font = .systemFont(ofSize: 12, weight: .regular) + label.textColor = .textColor + label.textAlignment = .center + label.numberOfLines = 0 + label.translatesAutoresizingMaskIntoConstraints = false + return label + }() + + private let spacer: UIView = { + let view = UIView() + view.setContentHuggingPriority(.defaultLow, for: .vertical) + view.setContentCompressionResistancePriority(.defaultLow, for: .vertical) + return view + }() + + private lazy var roktEmbeddedView: RoktEmbeddedView = RoktEmbeddedView() + + private lazy var loadingIndicator: UIActivityIndicatorView = { + let indicator = UIActivityIndicatorView(style: .medium) + indicator.hidesWhenStopped = true + indicator.isHidden = true + indicator.translatesAutoresizingMaskIntoConstraints = false + + view.addSubview(indicator) + NSLayoutConstraint.activate([ + indicator.centerXAnchor.constraint(equalTo: view.centerXAnchor), + indicator.centerYAnchor.constraint(equalTo: view.centerYAnchor) + ]) + return indicator + }() + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + view.backgroundColor = .white + view.addSubview(stackView) + view.addSubview(captionLabel) + + [ + imageView, + titleLabel, + spacer, + displayButton, + roktEmbeddedView + ].forEach { stackView.addArrangedSubview($0) } + + NSLayoutConstraint.activate([ + stackView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: Constants.padding), + stackView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: Constants.padding), + stackView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -Constants.padding), + stackView.bottomAnchor.constraint(lessThanOrEqualTo: captionLabel.topAnchor), + + captionLabel.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: Constants.padding), + captionLabel.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -Constants.padding), + captionLabel.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor), + + displayButton.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: Constants.padding), + ]) + } + + @objc private func buttonTapped() { + let attributes = [ + "email": "j.smith@example.com", + "firstname": "Jenny", + "lastname": "Smith", + "mobile": "(555)867-5309", + "postcode": "90210", + "country": "US" + ] + + MParticle + .sharedInstance() + .rokt + .selectPlacements( + "RoktEmbeddedExperience", + attributes: attributes, + placements: ["RoktEmbedded1": roktEmbeddedView], + onLoad: { + // Optional callback for when the Rokt placement loads + }, + onUnLoad: { [weak self] in + // Optional callback for when the Rokt placement unloads + self?.hideButton(false) + }, + onShouldShowLoadingIndicator: { [weak self] in + // Optional callback to show a loading indicator + self?.loadingIndicator.startAnimating() + }, + onShouldHideLoadingIndicator: { [weak self] in + self?.loadingIndicator.stopAnimating() + }, + onEmbeddedSizeChange: { selectedPlacement, widgetHeight in + // Optional callback to get selectedPlacement and height required by the placement every time the height of the placement changes + } + ) + hideButton(true) + } + + private func hideButton(_ hide: Bool) { + roktEmbeddedView.isHidden = !hide + displayButton.isHidden = hide + spacer.isHidden = hide + } +} diff --git a/Example/Example/Resources/Assets.xcassets/AccentColor.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/100.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/100.png new file mode 100644 index 0000000..3d1ab91 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/100.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/1024.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/1024.png new file mode 100644 index 0000000..fe7bb39 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/1024.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/114.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/114.png new file mode 100644 index 0000000..03f8c16 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/114.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/120.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/120.png new file mode 100644 index 0000000..7326733 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/120.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/128.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/128.png new file mode 100644 index 0000000..5ae3cff Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/128.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/144.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/144.png new file mode 100644 index 0000000..2335dd8 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/144.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/152.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/152.png new file mode 100644 index 0000000..65f402f Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/152.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/16.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/16.png new file mode 100644 index 0000000..f732cab Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/16.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/167.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/167.png new file mode 100644 index 0000000..a6fbb00 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/167.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/180.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/180.png new file mode 100644 index 0000000..6292593 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/180.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/20.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/20.png new file mode 100644 index 0000000..28b1e91 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/20.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/256.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/256.png new file mode 100644 index 0000000..ac28562 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/256.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/29.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/29.png new file mode 100644 index 0000000..4ca5e0f Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/29.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/32.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/32.png new file mode 100644 index 0000000..9582a73 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/32.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/40.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/40.png new file mode 100644 index 0000000..42bc91a Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/40.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/50.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/50.png new file mode 100644 index 0000000..4313824 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/50.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/512.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/512.png new file mode 100644 index 0000000..06c6dea Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/512.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/57.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/57.png new file mode 100644 index 0000000..54e0137 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/57.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/58.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/58.png new file mode 100644 index 0000000..0e60693 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/58.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/60.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/60.png new file mode 100644 index 0000000..14952df Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/60.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/64.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/64.png new file mode 100644 index 0000000..6be1a6e Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/64.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/72.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/72.png new file mode 100644 index 0000000..53ba810 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/72.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/76.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/76.png new file mode 100644 index 0000000..ae8413d Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/76.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/80.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/80.png new file mode 100644 index 0000000..8361fdd Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/80.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/87.png b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/87.png new file mode 100644 index 0000000..7b2c672 Binary files /dev/null and b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/87.png differ diff --git a/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..bbf91d1 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,218 @@ +{ + "images" : [ + { + "filename" : "40.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "60.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "filename" : "29.png", + "idiom" : "iphone", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "58.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "87.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "filename" : "80.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "120.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "filename" : "57.png", + "idiom" : "iphone", + "scale" : "1x", + "size" : "57x57" + }, + { + "filename" : "114.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "57x57" + }, + { + "filename" : "120.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "filename" : "180.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "filename" : "20.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "filename" : "40.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "29.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "58.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "40.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "filename" : "80.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "50.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "50x50" + }, + { + "filename" : "100.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "50x50" + }, + { + "filename" : "72.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "72x72" + }, + { + "filename" : "144.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "72x72" + }, + { + "filename" : "76.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "filename" : "152.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "filename" : "167.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "filename" : "1024.png", + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + }, + { + "filename" : "16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "256.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "512.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "1024.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/AccentColor.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..3006230 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/AccentColor.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x6D", + "green" : "0x1E", + "red" : "0xB5" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/Border.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/Border.colorset/Contents.json new file mode 100644 index 0000000..78408a9 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/Border.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xD9", + "green" : "0xD9", + "red" : "0xD9" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/Gray12.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/Gray12.colorset/Contents.json new file mode 100644 index 0000000..bfb5070 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/Gray12.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x14", + "green" : "0x14", + "red" : "0x14" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/Gray3.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/Gray3.colorset/Contents.json new file mode 100644 index 0000000..ae8dde8 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/Gray3.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xF5", + "green" : "0xF5", + "red" : "0xF5" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/Gray4.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/Gray4.colorset/Contents.json new file mode 100644 index 0000000..b9cb151 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/Gray4.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xF0", + "green" : "0xF0", + "red" : "0xF0" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/Gray7.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/Gray7.colorset/Contents.json new file mode 100644 index 0000000..2e4a98b --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/Gray7.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x8C", + "green" : "0x8C", + "red" : "0x8C" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/Gray9.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/Gray9.colorset/Contents.json new file mode 100644 index 0000000..5e9e9b8 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/Gray9.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x43", + "green" : "0x43", + "red" : "0x43" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Black.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Black.colorset/Contents.json new file mode 100644 index 0000000..eee0cbc --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Black.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "46", + "green" : "48", + "red" : "54" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Gray1.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Gray1.colorset/Contents.json new file mode 100644 index 0000000..3ca0c9a --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Gray1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "237", + "green" : "236", + "red" : "235" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Gray2.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Gray2.colorset/Contents.json new file mode 100644 index 0000000..a57b4ca --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Gray2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "123", + "green" : "120", + "red" : "117" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Gray3.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Gray3.colorset/Contents.json new file mode 100644 index 0000000..56372ee --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Gray3.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "215", + "green" : "212", + "red" : "209" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Green.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Green.colorset/Contents.json new file mode 100644 index 0000000..4910c14 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined1Green.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "23", + "green" : "163", + "red" : "83" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined2Black.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined2Black.colorset/Contents.json new file mode 100644 index 0000000..e2cc874 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined2Black.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "55", + "green" : "49", + "red" : "43" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined2Gray1.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined2Gray1.colorset/Contents.json new file mode 100644 index 0000000..77d5cc5 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined2Gray1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "154", + "green" : "142", + "red" : "131" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined2Gray2.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined2Gray2.colorset/Contents.json new file mode 100644 index 0000000..cd8e450 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined2Gray2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "196", + "green" : "194", + "red" : "192" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined2Purple.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined2Purple.colorset/Contents.json new file mode 100644 index 0000000..2ebbe5e --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined2Purple.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "134", + "green" : "64", + "red" : "218" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Black1.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Black1.colorset/Contents.json new file mode 100644 index 0000000..b6e675c --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Black1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "34", + "green" : "32", + "red" : "32" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Black2.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Black2.colorset/Contents.json new file mode 100644 index 0000000..08d949e --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Black2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "70", + "green" : "69", + "red" : "68" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Blue.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Blue.colorset/Contents.json new file mode 100644 index 0000000..59a1819 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Blue.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "125", + "green" : "39", + "red" : "14" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Gray1.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Gray1.colorset/Contents.json new file mode 100644 index 0000000..0305fb7 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Gray1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "225", + "green" : "224", + "red" : "223" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Gray2.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Gray2.colorset/Contents.json new file mode 100644 index 0000000..08d949e --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Gray2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "70", + "green" : "69", + "red" : "68" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Gray3.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Gray3.colorset/Contents.json new file mode 100644 index 0000000..59a1d96 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Gray3.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "163", + "green" : "162", + "red" : "157" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Green.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Green.colorset/Contents.json new file mode 100644 index 0000000..b7399ed --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefined3Green.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "50", + "green" : "171", + "red" : "55" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefinedWhite.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefinedWhite.colorset/Contents.json new file mode 100644 index 0000000..97650a1 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/PreDefined/PreDefinedWhite.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Colors/Volcano.colorset/Contents.json b/Example/Example/Resources/Assets.xcassets/Colors/Volcano.colorset/Contents.json new file mode 100644 index 0000000..e09e56c --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Colors/Volcano.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x0D", + "green" : "0x38", + "red" : "0xD4" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/Contents.json b/Example/Example/Resources/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/RoktLogo.imageset/Contents.json b/Example/Example/Resources/Assets.xcassets/RoktLogo.imageset/Contents.json new file mode 100644 index 0000000..9592011 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/RoktLogo.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "rokt-logo.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Example/Resources/Assets.xcassets/RoktLogo.imageset/rokt-logo.svg b/Example/Example/Resources/Assets.xcassets/RoktLogo.imageset/rokt-logo.svg new file mode 100644 index 0000000..a1a5091 --- /dev/null +++ b/Example/Example/Resources/Assets.xcassets/RoktLogo.imageset/rokt-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Example/Example/Resources/Base.lproj/LaunchScreen.storyboard b/Example/Example/Resources/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/Example/Example/Resources/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Example/Resources/Info.plist b/Example/Example/Resources/Info.plist new file mode 100644 index 0000000..0c67376 --- /dev/null +++ b/Example/Example/Resources/Info.plist @@ -0,0 +1,5 @@ + + + + + diff --git a/Example/Example/Shared/UIColor+extensions.swift b/Example/Example/Shared/UIColor+extensions.swift new file mode 100644 index 0000000..9d3124e --- /dev/null +++ b/Example/Example/Shared/UIColor+extensions.swift @@ -0,0 +1,11 @@ + +import UIKit + +extension UIColor { + static let appColor = UIColor(named: "AccentColor") + static let titleColor = UIColor(named: "Gray12") + static let subtitleColor = UIColor(named: "Gray7") + static let textColor = UIColor(named: "Gray9") + static let borderColor = UIColor(named: "Border") + static let errorColor = UIColor(named: "Volcano") +} diff --git a/Example/README.md b/Example/README.md new file mode 100644 index 0000000..f058430 --- /dev/null +++ b/Example/README.md @@ -0,0 +1,74 @@ +# Rokt Integration Example App + +This example app demonstrates how to integrate and use the mParticle Rokt kit in an iOS application. It shows how to initialize the SDK and display a Rokt embedded view in your app. + +## Features + +- Initializes the mParticle SDK with the Rokt kit +- Demonstrates how to create and display a Rokt embedded view +- Shows how to pass user attributes to personalize the Rokt experience +- Provides a simple UI to trigger the Rokt layout + +## Setup + +1. Clone this repository +2. Open `Example.xcodeproj` in Xcode +3. Set your mParticle API key and initialize the SDK in the AppDelegate within the `application:didFinishLaunchingWithOptions:` method: + ```swift + // In AppDelegate.swift + MParticle.sharedInstance().start(with: MParticleOptions(key: "YOUR_API_KEY", secret: "YOUR_API_SECRET")) + ``` +4. Run the app on a simulator or device + +## How It Works + +The example app consists of two main screens: + +1. **Home Screen (`HomeViewController`)**: + - Displays a simple UI with a button to launch the Rokt experience + - Creates a Rokt embedded view and adds it to the view hierarchy + - Initializes the Rokt integration with user attributes + - Demonstrates how to use callbacks for various Rokt widget events (loading, unloading, size changes) + +### Code Example + +Here's the key integration code from `HomeViewController.swift`: + +```swift +MParticle + .sharedInstance() + .rokt + .selectPlacements( + "RoktEmbeddedExperience", // View name for the Rokt experience + attributes: attributes, // User attributes + placements: ["RoktEmbedded1": roktEmbeddedView], // Placement name and view + onLoad: { + // Optional callback for when the Rokt placement loads + }, + onUnLoad: { + // Optional callback for when the Rokt placement unloads + }, + onShouldShowLoadingIndicator: { + // Optional callback to show a loading indicator + }, + onShouldHideLoadingIndicator: { + // Optional callback to hide a loading indicator + }, + onEmbeddedSizeChange: { selectedPlacement, widgetHeight in + // Optional callback for placement size changes + } + ) +``` + +## Requirements + +- iOS 12.0+ +- Xcode 15.0+ +- mParticle iOS SDK +- Rokt Widget SDK + +## Notes + +- Replace the placeholder mParticle API key and secret with your actual credentials + +For more details on the mParticle Rokt integration, refer to the [documentation](https://docs.mparticle.com/integrations/rokt/event/). \ No newline at end of file diff --git a/README.md b/README.md index 152fb0d..b664399 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,15 @@ This repository contains the Rokt integration for the [mParticle Apple SDK](http 3. Reference mParticle's integration docs below to enable the integration. +### Example App + +This repository includes an Example app that demonstrates how to use the Rokt integration with mParticle. The example shows how to: +- Initialize the mParticle SDK with the Rokt kit +- Display a Rokt embedded widget within your app +- Pass user attributes to personalize the Rokt experience + +Check out the [Example](./Example) directory for more details. + ### Documentation [Rokt integration](https://docs.mparticle.com/integrations/rokt/event/) diff --git a/mParticle-Rokt/MPKitRokt.m b/mParticle-Rokt/MPKitRokt.m index d35cb0d..22627b4 100644 --- a/mParticle-Rokt/MPKitRokt.m +++ b/mParticle-Rokt/MPKitRokt.m @@ -124,7 +124,7 @@ - (MPKitExecStatus *)executeWithIdentifier:(NSString * _Nullable)identifier onShouldHideLoadingIndicator:callbacks.onShouldHideLoadingIndicator onEmbeddedSizeChange:callbacks.onEmbeddedSizeChange ]; - + return [[MPKitExecStatus alloc] initWithSDKCode:[[self class] kitCode] returnCode:MPKitReturnCodeSuccess]; }