diff --git a/.github/workflows/ampli-merge-check.ios.yml b/.github/workflows/ampli-merge-check.ios.yml index af428b98..f6004e07 100644 --- a/.github/workflows/ampli-merge-check.ios.yml +++ b/.github/workflows/ampli-merge-check.ios.yml @@ -27,6 +27,10 @@ jobs: working-directory: ./ios/swift/v2/AmpliSwiftSampleApp run: ampli status --is-merged -t ${{secrets.AMPLI_TOKEN}} - - name: (iOS Objective-C) Check the Data branch is merged before merging the Git branch + - name: (iOS Objective-C V1) Check the Data branch is merged before merging the Git branch working-directory: ./ios/objective-c/v1/AmpliObjectiveCSampleApp run: ampli status --is-merged -t ${{secrets.AMPLI_TOKEN}} + + - name: (iOS Objective-C V2) Check the Data branch is merged before merging the Git branch + working-directory: ./ios/objective-c/v2/AmpliObjectiveCSampleApp + run: ampli status --is-merged -t ${{secrets.AMPLI_TOKEN}} diff --git a/.github/workflows/ci-build-ios-v2-test.yml b/.github/workflows/ci-build-ios-v2-test.yml index 5e2b3bdf..6f043468 100644 --- a/.github/workflows/ci-build-ios-v2-test.yml +++ b/.github/workflows/ci-build-ios-v2-test.yml @@ -3,6 +3,7 @@ name: CI - iOS V2 Tests on: pull_request: paths: + - 'ios/objective-c/v2/**' - 'ios/swift/v2/**' jobs: @@ -28,3 +29,12 @@ jobs: -scheme AmpliSwiftSampleAppTests \ -sdk iphonesimulator \ -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.2' + + - name: Objective-C iOS Tests + working-directory: ./ios/objective-c/v2/AmpliObjectiveCSampleApp + run: | + xcodebuild test \ + -project AmpliObjectiveCSampleApp.xcodeproj \ + -scheme AmpliObjectiveCSampleApp \ + -sdk iphonesimulator \ + -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.2' diff --git a/README.md b/README.md index c1ff1719..06b55db3 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ See subproject README's for details on each platform. ## iOS V2 #### [ios/swift](ios/swift/v2/AmpliSwiftSampleApp) +#### [ios/objective-c](ios/objective-c/v2/AmpliObjectiveCSampleApp) ## Android V1 #### [android/kotlin](android/kotlin/v1/AmpliApp) diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.pbxproj b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.pbxproj new file mode 100644 index 00000000..230eec01 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.pbxproj @@ -0,0 +1,542 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + 3E3B5F85274F5139003D95E1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E3B5F84274F5139003D95E1 /* AppDelegate.m */; }; + 3E3B5F88274F5139003D95E1 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E3B5F87274F5139003D95E1 /* SceneDelegate.m */; }; + 3E3B5F8B274F5139003D95E1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E3B5F8A274F5139003D95E1 /* ViewController.m */; }; + 3E3B5F8E274F5139003D95E1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3E3B5F8C274F5139003D95E1 /* Main.storyboard */; }; + 3E3B5F90274F513F003D95E1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3E3B5F8F274F513F003D95E1 /* Assets.xcassets */; }; + 3E3B5F93274F513F003D95E1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3E3B5F91274F513F003D95E1 /* LaunchScreen.storyboard */; }; + 3E3B5F96274F513F003D95E1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E3B5F95274F513F003D95E1 /* main.m */; }; + 3E3B5FA0274F558D003D95E1 /* Ampli.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E3B5F9D274F558D003D95E1 /* Ampli.m */; }; + 3E3B5FC2275947E8003D95E1 /* AmpliTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E3B5FC1275947E8003D95E1 /* AmpliTests.m */; }; + BA1657482AC3FE7100367475 /* AmplitudeSwift in Frameworks */ = {isa = PBXBuildFile; productRef = BA1657472AC3FE7100367475 /* AmplitudeSwift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 3E3B5FBC2759438C003D95E1 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3E3B5F78274F5139003D95E1 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3E3B5F7F274F5139003D95E1; + remoteInfo = AmpliObjectiveCSampleApp; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 3E3B5F80274F5139003D95E1 /* AmpliObjectiveCSampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AmpliObjectiveCSampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 3E3B5F83274F5139003D95E1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 3E3B5F84274F5139003D95E1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 3E3B5F86274F5139003D95E1 /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = ""; }; + 3E3B5F87274F5139003D95E1 /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = ""; }; + 3E3B5F89274F5139003D95E1 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 3E3B5F8A274F5139003D95E1 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 3E3B5F8D274F5139003D95E1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 3E3B5F8F274F513F003D95E1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 3E3B5F92274F513F003D95E1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 3E3B5F94274F513F003D95E1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 3E3B5F95274F513F003D95E1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 3E3B5F9D274F558D003D95E1 /* Ampli.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Ampli.m; sourceTree = ""; }; + 3E3B5F9F274F558D003D95E1 /* Ampli.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Ampli.h; sourceTree = ""; }; + 3E3B5FB82759438C003D95E1 /* AmpliObjectiveCSampleAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AmpliObjectiveCSampleAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3E3B5FC1275947E8003D95E1 /* AmpliTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AmpliTests.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3E3B5F7D274F5139003D95E1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + BA1657482AC3FE7100367475 /* AmplitudeSwift in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3E3B5FB52759438C003D95E1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3E3B5F77274F5139003D95E1 = { + isa = PBXGroup; + children = ( + 3E3B5F82274F5139003D95E1 /* AmpliObjectiveCSampleApp */, + 3E3B5FB92759438C003D95E1 /* AmpliObjectiveCSampleAppTests */, + 3E3B5F81274F5139003D95E1 /* Products */, + AC0776CE16F572A113FE1618 /* Pods */, + ); + sourceTree = ""; + }; + 3E3B5F81274F5139003D95E1 /* Products */ = { + isa = PBXGroup; + children = ( + 3E3B5F80274F5139003D95E1 /* AmpliObjectiveCSampleApp.app */, + 3E3B5FB82759438C003D95E1 /* AmpliObjectiveCSampleAppTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 3E3B5F82274F5139003D95E1 /* AmpliObjectiveCSampleApp */ = { + isa = PBXGroup; + children = ( + 3E3B5F9C274F558D003D95E1 /* Ampli */, + 3E3B5F83274F5139003D95E1 /* AppDelegate.h */, + 3E3B5F84274F5139003D95E1 /* AppDelegate.m */, + 3E3B5F86274F5139003D95E1 /* SceneDelegate.h */, + 3E3B5F87274F5139003D95E1 /* SceneDelegate.m */, + 3E3B5F89274F5139003D95E1 /* ViewController.h */, + 3E3B5F8A274F5139003D95E1 /* ViewController.m */, + 3E3B5F8C274F5139003D95E1 /* Main.storyboard */, + 3E3B5F8F274F513F003D95E1 /* Assets.xcassets */, + 3E3B5F91274F513F003D95E1 /* LaunchScreen.storyboard */, + 3E3B5F94274F513F003D95E1 /* Info.plist */, + 3E3B5F95274F513F003D95E1 /* main.m */, + ); + path = AmpliObjectiveCSampleApp; + sourceTree = ""; + }; + 3E3B5F9C274F558D003D95E1 /* Ampli */ = { + isa = PBXGroup; + children = ( + 3E3B5F9D274F558D003D95E1 /* Ampli.m */, + 3E3B5F9F274F558D003D95E1 /* Ampli.h */, + ); + path = Ampli; + sourceTree = ""; + }; + 3E3B5FB92759438C003D95E1 /* AmpliObjectiveCSampleAppTests */ = { + isa = PBXGroup; + children = ( + 3E3B5FC1275947E8003D95E1 /* AmpliTests.m */, + ); + path = AmpliObjectiveCSampleAppTests; + sourceTree = ""; + }; + AC0776CE16F572A113FE1618 /* Pods */ = { + isa = PBXGroup; + children = ( + ); + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 3E3B5F7F274F5139003D95E1 /* AmpliObjectiveCSampleApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3E3B5F99274F513F003D95E1 /* Build configuration list for PBXNativeTarget "AmpliObjectiveCSampleApp" */; + buildPhases = ( + 3E3B5F7C274F5139003D95E1 /* Sources */, + 3E3B5F7D274F5139003D95E1 /* Frameworks */, + 3E3B5F7E274F5139003D95E1 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AmpliObjectiveCSampleApp; + packageProductDependencies = ( + BA1657472AC3FE7100367475 /* AmplitudeSwift */, + ); + productName = AmpliObjectiveCSampleApp; + productReference = 3E3B5F80274F5139003D95E1 /* AmpliObjectiveCSampleApp.app */; + productType = "com.apple.product-type.application"; + }; + 3E3B5FB72759438C003D95E1 /* AmpliObjectiveCSampleAppTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3E3B5FC02759438C003D95E1 /* Build configuration list for PBXNativeTarget "AmpliObjectiveCSampleAppTests" */; + buildPhases = ( + 3E3B5FB42759438C003D95E1 /* Sources */, + 3E3B5FB52759438C003D95E1 /* Frameworks */, + 3E3B5FB62759438C003D95E1 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 3E3B5FBD2759438C003D95E1 /* PBXTargetDependency */, + ); + name = AmpliObjectiveCSampleAppTests; + productName = AmpliObjectiveCSampleAppTests; + productReference = 3E3B5FB82759438C003D95E1 /* AmpliObjectiveCSampleAppTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 3E3B5F78274F5139003D95E1 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastUpgradeCheck = 1310; + TargetAttributes = { + 3E3B5F7F274F5139003D95E1 = { + CreatedOnToolsVersion = 13.1; + }; + 3E3B5FB72759438C003D95E1 = { + CreatedOnToolsVersion = 13.1; + TestTargetID = 3E3B5F7F274F5139003D95E1; + }; + }; + }; + buildConfigurationList = 3E3B5F7B274F5139003D95E1 /* Build configuration list for PBXProject "AmpliObjectiveCSampleApp" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 3E3B5F77274F5139003D95E1; + packageReferences = ( + BA1657462AC3FE7100367475 /* XCRemoteSwiftPackageReference "Amplitude-Swift" */, + ); + productRefGroup = 3E3B5F81274F5139003D95E1 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 3E3B5F7F274F5139003D95E1 /* AmpliObjectiveCSampleApp */, + 3E3B5FB72759438C003D95E1 /* AmpliObjectiveCSampleAppTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 3E3B5F7E274F5139003D95E1 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3E3B5F93274F513F003D95E1 /* LaunchScreen.storyboard in Resources */, + 3E3B5F90274F513F003D95E1 /* Assets.xcassets in Resources */, + 3E3B5F8E274F5139003D95E1 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3E3B5FB62759438C003D95E1 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 3E3B5F7C274F5139003D95E1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3E3B5FA0274F558D003D95E1 /* Ampli.m in Sources */, + 3E3B5F8B274F5139003D95E1 /* ViewController.m in Sources */, + 3E3B5F85274F5139003D95E1 /* AppDelegate.m in Sources */, + 3E3B5F96274F513F003D95E1 /* main.m in Sources */, + 3E3B5F88274F5139003D95E1 /* SceneDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3E3B5FB42759438C003D95E1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3E3B5FC2275947E8003D95E1 /* AmpliTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 3E3B5FBD2759438C003D95E1 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3E3B5F7F274F5139003D95E1 /* AmpliObjectiveCSampleApp */; + targetProxy = 3E3B5FBC2759438C003D95E1 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 3E3B5F8C274F5139003D95E1 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 3E3B5F8D274F5139003D95E1 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 3E3B5F91274F513F003D95E1 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 3E3B5F92274F513F003D95E1 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 3E3B5F97274F513F003D95E1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_CXX_LIBRARY = "libc++"; + 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; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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 = 15.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 3E3B5F98274F513F003D95E1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_CXX_LIBRARY = "libc++"; + 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"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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 = 15.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 3E3B5F9A274F513F003D95E1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = AmpliObjectiveCSampleApp/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + 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.amplitude.AmpliObjectiveCSampleApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 3E3B5F9B274F513F003D95E1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = AmpliObjectiveCSampleApp/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + 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.amplitude.AmpliObjectiveCSampleApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 3E3B5FBE2759438C003D95E1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliObjectiveCSampleAppTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AmpliObjectiveCSampleApp.app/AmpliObjectiveCSampleApp"; + }; + name = Debug; + }; + 3E3B5FBF2759438C003D95E1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliObjectiveCSampleAppTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AmpliObjectiveCSampleApp.app/AmpliObjectiveCSampleApp"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 3E3B5F7B274F5139003D95E1 /* Build configuration list for PBXProject "AmpliObjectiveCSampleApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3E3B5F97274F513F003D95E1 /* Debug */, + 3E3B5F98274F513F003D95E1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3E3B5F99274F513F003D95E1 /* Build configuration list for PBXNativeTarget "AmpliObjectiveCSampleApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3E3B5F9A274F513F003D95E1 /* Debug */, + 3E3B5F9B274F513F003D95E1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3E3B5FC02759438C003D95E1 /* Build configuration list for PBXNativeTarget "AmpliObjectiveCSampleAppTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3E3B5FBE2759438C003D95E1 /* Debug */, + 3E3B5FBF2759438C003D95E1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + BA1657462AC3FE7100367475 /* XCRemoteSwiftPackageReference "Amplitude-Swift" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/amplitude/Amplitude-Swift"; + requirement = { + branch = "AMP-67635-objc-support-properties"; + kind = branch; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + BA1657472AC3FE7100367475 /* AmplitudeSwift */ = { + isa = XCSwiftPackageProductDependency; + package = BA1657462AC3FE7100367475 /* XCRemoteSwiftPackageReference "Amplitude-Swift" */; + productName = AmplitudeSwift; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 3E3B5F78274F5139003D95E1 /* Project object */; +} diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliObjectiveCSampleApp.xcscheme b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliObjectiveCSampleApp.xcscheme new file mode 100644 index 00000000..96f0698f --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliObjectiveCSampleApp.xcscheme @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.h b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.h new file mode 100644 index 00000000..172d0c57 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.h @@ -0,0 +1,636 @@ +/** + * Ampli - A strong typed wrapper for your Analytics + * + * This file is generated by Amplitude. + * To update run 'ampli pull obj-c-ampli-v2' + * + * Required dependencies: AmplitudeSwift ~> 0.7.1 + * Tracking Plan Version: 1 + * Build: 1.0.0 + * Runtime: ios:obj-c-ampli-v2 + * + * [View Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest) + * + * [Full Setup Instructions](https://data.amplitude.com/test-codegen/Test%20Codegen/implementation/obj-c-ampli-v2) + */ +#import +@import AmplitudeSwift; + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSInteger, AmpliEnvironment) { + prod, + dev +}; + +@interface Event: NSObject +@property (nonatomic, strong, readonly) NSString* eventType; +@property (nonatomic, strong, readonly) NSDictionary* _Nullable eventProperties; +@property (nonatomic, strong, readonly) AMPEventOptions* _Nullable options; +@end + +@interface LoadClientOptions: NSObject +@property (nonatomic, strong, readonly) Amplitude* _Nullable instance; +@property (nonatomic, strong, readonly) AMPConfiguration* _Nullable configuration; ++ (instancetype) initWithApiKey:(NSString*)apiKey; ++ (instancetype) initWithInstance:(Amplitude*)instance; ++ (instancetype) initWithConfiguration:(AMPConfiguration*)configuration; +@end + +@interface LoadOptions: NSObject +@property (nonatomic, readonly) AmpliEnvironment environment; +@property (nonatomic, readwrite) BOOL disabled; +@property (nonatomic, strong, readonly) LoadClientOptions* _Nullable client; ++ (instancetype) initWithApiKey:(NSString*)apiKey; ++ (instancetype) initWithEnvironment:(AmpliEnvironment)environment; ++ (instancetype) initWithClientOptions:(LoadClientOptions*)client; ++ (instancetype) initWithDisabled:(BOOL)disabled; +@end + +#pragma mark - IdentifyBuilder + +@interface IdentifyBuilder: NSObject +@property (nonatomic) NSArray * _Nullable optionalArray; +@end + +#pragma mark - Identify + +@interface Identify: Event +/** + Identify properties. + + @param requiredNumber Description for identify requiredNumber +*/ ++ (instancetype) requiredNumber:(Float64)requiredNumber NS_SWIFT_NAME(build(requiredNumber:)); ++ (instancetype) requiredNumber:(Float64)requiredNumber builderBlock:(void (^)(IdentifyBuilder *b))builderBlock NS_SWIFT_NAME(build(requiredNumber:builderBlock:)); + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; +@end + +#pragma mark - EventNoProperties + +@interface EventNoProperties: Event +/** + Event w no properties description + + Owner: Test codegen +*/ +- (instancetype)init; +@end + +#pragma mark - EventObjectTypes + +@interface EventObjectTypes: Event +/** + Event with Object and Object Array + + Owner: Test codegen + + @param requiredObject Property Object Type + @param requiredObjectArray Property Object Array Type +*/ ++ (instancetype) requiredObject:(NSDictionary *)requiredObject requiredObjectArray:(NSArray *> *)requiredObjectArray NS_SWIFT_NAME(build(requiredObject:requiredObjectArray:)); + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; +@end + +#pragma mark - EventWithAllProperties Enums + +typedef NS_ENUM(NSInteger, EventWithAllPropertiesRequiredEnum) { + EventWithAllPropertiesRequiredEnumEnum1, + EventWithAllPropertiesRequiredEnumEnum2 +}; + +#pragma mark - EventWithAllPropertiesBuilder + +@interface EventWithAllPropertiesBuilder: NSObject +@property (nonatomic) NSString* _Nullable optionalString; +@end + +#pragma mark - EventWithAllProperties + +@interface EventWithAllProperties: Event +/** + Event w all properties description + + Owner: Test codegen + + @param requiredArray Event 2 Property - Array + @param requiredBoolean Event 2 Property - Boolean + @param requiredEnum Event 2 Property - Enum + @param requiredInteger Event 2 Property - Integer * * Examples: * 5, 4, 3 + @param requiredNumber Event 2 Property - Number + @param requiredString Event 2 Property - String +*/ ++ (instancetype) requiredArray:(NSArray *)requiredArray requiredBoolean:(Boolean)requiredBoolean requiredEnum:(EventWithAllPropertiesRequiredEnum)requiredEnum requiredInteger:(NSInteger)requiredInteger requiredNumber:(Float64)requiredNumber requiredString:(NSString*)requiredString NS_SWIFT_NAME(build(requiredArray:requiredBoolean:requiredEnum:requiredInteger:requiredNumber:requiredString:)); ++ (instancetype) requiredArray:(NSArray *)requiredArray requiredBoolean:(Boolean)requiredBoolean requiredEnum:(EventWithAllPropertiesRequiredEnum)requiredEnum requiredInteger:(NSInteger)requiredInteger requiredNumber:(Float64)requiredNumber requiredString:(NSString*)requiredString builderBlock:(void (^)(EventWithAllPropertiesBuilder *b))builderBlock NS_SWIFT_NAME(build(requiredArray:requiredBoolean:requiredEnum:requiredInteger:requiredNumber:requiredString:builderBlock:)); + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; +@end + +#pragma mark - EventWithArrayTypes + +@interface EventWithArrayTypes: Event +/** + Description for event with Array Types + + Owner: Test codegen + + @param requiredBooleanArray description for required boolean array + @param requiredEnumArray Description for enum array property + @param requiredNumberArray Description for required number array + @param requiredObjectArray Description for required object array + @param requiredStringArray description for required string array +*/ ++ (instancetype) requiredBooleanArray:(NSArray *)requiredBooleanArray requiredEnumArray:(NSArray *)requiredEnumArray requiredNumberArray:(NSArray *)requiredNumberArray requiredObjectArray:(NSArray *> *)requiredObjectArray requiredStringArray:(NSArray *)requiredStringArray NS_SWIFT_NAME(build(requiredBooleanArray:requiredEnumArray:requiredNumberArray:requiredObjectArray:requiredStringArray:)); + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; +@end + +#pragma mark - EventWithConstTypes + +@interface EventWithConstTypes: Event +/** + Description for event with const types + + Owner: Test codegen +*/ +- (instancetype)init; +@end + +#pragma mark - EventWithEnumTypes Enums + +typedef NS_ENUM(NSInteger, EventWithEnumTypesOptionalEnum) { + EventWithEnumTypesOptionalEnumOptionalEnum1, + EventWithEnumTypesOptionalEnumOptionalEnum2, + EventWithEnumTypesOptionalEnumUndefined +}; + +typedef NS_ENUM(NSInteger, EventWithEnumTypesRequiredEnum) { + EventWithEnumTypesRequiredEnumRequiredEnum1, + EventWithEnumTypesRequiredEnumRequiredEnum2 +}; + +#pragma mark - EventWithEnumTypesBuilder + +@interface EventWithEnumTypesBuilder: NSObject +@property (nonatomic) EventWithEnumTypesOptionalEnum optionalEnum; +@end + +#pragma mark - EventWithEnumTypes + +@interface EventWithEnumTypes: Event +/** + Description for event with enum types + + Owner: Test codegen + + @param requiredEnum Description for optional enum +*/ ++ (instancetype) requiredEnum:(EventWithEnumTypesRequiredEnum)requiredEnum NS_SWIFT_NAME(build(requiredEnum:)); ++ (instancetype) requiredEnum:(EventWithEnumTypesRequiredEnum)requiredEnum builderBlock:(void (^)(EventWithEnumTypesBuilder *b))builderBlock NS_SWIFT_NAME(build(requiredEnum:builderBlock:)); + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; +@end + +#pragma mark - EventWithOptionalArrayTypesBuilder + +@interface EventWithOptionalArrayTypesBuilder: NSObject +@property (nonatomic) NSArray * _Nullable optionalBooleanArray; +@property (nonatomic) NSArray * _Nullable optionalEnumArray; +@property (nonatomic) NSArray *> * _Nullable optionalJsonArray; +@property (nonatomic) NSArray * _Nullable optionalNumberArray; +@property (nonatomic) NSArray * _Nullable optionalStringArray; +@end + +#pragma mark - EventWithOptionalArrayTypes + +@interface EventWithOptionalArrayTypes: Event +/** + Description for event with optional array types + + Owner: Test codegen +*/ ++ (instancetype) builderBlock:(void (^)(EventWithOptionalArrayTypesBuilder *b))builderBlock NS_SWIFT_NAME(build(builderBlock:)); + +- (instancetype)init; +@end + +#pragma mark - EventWithOptionalPropertiesBuilder + +@interface EventWithOptionalPropertiesBuilder: NSObject +@property (nonatomic) NSArray * _Nullable optionalArrayNumber; +@property (nonatomic) NSArray * _Nullable optionalArrayString; +@property (nonatomic) NSNumber* _Nullable optionalBoolean; +@property (nonatomic) NSNumber* _Nullable optionalNumber; +@property (nonatomic) NSString* _Nullable optionalString; +@end + +#pragma mark - EventWithOptionalProperties + +@interface EventWithOptionalProperties: Event +/** + Event w optional properties description + + Owner: Test codegen +*/ ++ (instancetype) builderBlock:(void (^)(EventWithOptionalPropertiesBuilder *b))builderBlock NS_SWIFT_NAME(build(builderBlock:)); + +- (instancetype)init; +@end + +#pragma mark - EventWithTemplatePropertiesBuilder + +@interface EventWithTemplatePropertiesBuilder: NSObject +@property (nonatomic) NSNumber* _Nullable optionalEventProperty; +@property (nonatomic) NSNumber* _Nullable optionalTemplateProperty; +@end + +#pragma mark - EventWithTemplateProperties + +@interface EventWithTemplateProperties: Event +/** + Event with template properties description + + Owner: Test codegen + + @param requiredEventProperty required_event_property description + @param requiredTemplateProperty required_template_property description +*/ ++ (instancetype) requiredEventProperty:(NSString*)requiredEventProperty requiredTemplateProperty:(NSString*)requiredTemplateProperty NS_SWIFT_NAME(build(requiredEventProperty:requiredTemplateProperty:)); ++ (instancetype) requiredEventProperty:(NSString*)requiredEventProperty requiredTemplateProperty:(NSString*)requiredTemplateProperty builderBlock:(void (^)(EventWithTemplatePropertiesBuilder *b))builderBlock NS_SWIFT_NAME(build(requiredEventProperty:requiredTemplateProperty:builderBlock:)); + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; +@end + +#pragma mark - EventWithDifferentCasingTypes Enums + +typedef NS_ENUM(NSInteger, EventWithDifferentCasingTypesEnumWithSpace) { + EventWithDifferentCasingTypesEnumWithSpaceEnumWithSpace +}; + +typedef NS_ENUM(NSInteger, EventWithDifferentCasingTypesEnumSnakeCase) { + EventWithDifferentCasingTypesEnumSnakeCaseEnumSnakeCase +}; + +typedef NS_ENUM(NSInteger, EventWithDifferentCasingTypesEnumCamelCase) { + EventWithDifferentCasingTypesEnumCamelCaseEnumCamelCase +}; + +typedef NS_ENUM(NSInteger, EventWithDifferentCasingTypesEnumPascalCase) { + EventWithDifferentCasingTypesEnumPascalCaseEnumPascalCase +}; + +#pragma mark - EventWithDifferentCasingTypes + +@interface EventWithDifferentCasingTypes: Event +/** + Description for case with space + + Owner: Test codegen + + @param enumWithSpace Description for enum with space + @param enumSnakeCase description_for_enum_snake_case + @param enumCamelCase descriptionForEnumCamelCase + @param enumPascalCase DescirptionForEnumPascalCase + @param propertyWithSpace Description for case with space + @param propertyWithSnakeCase Description_for_snake_case + @param propertyWithCamelCase descriptionForCamelCase + @param propertyWithPascalCase DescriptionForPascalCase +*/ ++ (instancetype) enumWithSpace:(EventWithDifferentCasingTypesEnumWithSpace)enumWithSpace enumSnakeCase:(EventWithDifferentCasingTypesEnumSnakeCase)enumSnakeCase enumCamelCase:(EventWithDifferentCasingTypesEnumCamelCase)enumCamelCase enumPascalCase:(EventWithDifferentCasingTypesEnumPascalCase)enumPascalCase propertyWithSpace:(NSString*)propertyWithSpace propertyWithSnakeCase:(NSString*)propertyWithSnakeCase propertyWithCamelCase:(NSString*)propertyWithCamelCase propertyWithPascalCase:(NSString*)propertyWithPascalCase NS_SWIFT_NAME(build(enumWithSpace:enumSnakeCase:enumCamelCase:enumPascalCase:propertyWithSpace:propertyWithSnakeCase:propertyWithCamelCase:propertyWithPascalCase:)); + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; +@end + +#pragma mark - EventMaxIntForTest + +@interface EventMaxIntForTest: Event +/** + Event to test schema validation + + Owner: Test codegen + + @param intMax10 property to test schema validation +*/ ++ (instancetype) intMax10:(NSInteger)intMax10 NS_SWIFT_NAME(build(intMax10:)); + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; +@end + +@interface Ampli: NSObject +@property (nonatomic, strong, readonly) Amplitude* _Nullable client; +@property (nonatomic, assign, readonly) BOOL isLoaded; +@property (nonatomic, assign, readwrite) BOOL disabled; ++ (instancetype)instance; +- (instancetype)init; +- (void)load; +- (void)load:(LoadOptions* _Nullable)options; +- (void)track:(Event*)event; +- (void)track:(Event*)event options:(AMPEventOptions* _Nullable)options; +- (void)identify:(NSString* _Nullable)userId event:(Identify* )event; +- (void)identify:(NSString* _Nullable)userId event:(Identify* )event options:(AMPEventOptions* _Nullable)options; +- (void)flush; +/** +Event No Properties + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20No%20Properties) + +Event w no properties description + +Owner: Test codegen + +@param options Optional AMPEventOptions +*/ +- (void)eventNoProperties:(AMPEventOptions *_Nullable)options; + +/** +Event No Properties + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20No%20Properties) + +Event w no properties description + +Owner: Test codegen + +*/ +- (void)eventNoProperties; + +/** +Event Object Types + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20Object%20Types) + +Event with Object and Object Array + +Owner: Test codegen + +@param event The event +@param options Optional AMPEventOptions +*/ +- (void)eventObjectTypes:(EventObjectTypes *)event options:(AMPEventOptions *_Nullable)options; + +/** +Event Object Types + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20Object%20Types) + +Event with Object and Object Array + +Owner: Test codegen + +@param event The event +*/ +- (void)eventObjectTypes:(EventObjectTypes *)event; + +/** +Event With All Properties + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20All%20Properties) + +Event w all properties description + +Owner: Test codegen + +@param event The event +@param options Optional AMPEventOptions +*/ +- (void)eventWithAllProperties:(EventWithAllProperties *)event options:(AMPEventOptions *_Nullable)options; + +/** +Event With All Properties + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20All%20Properties) + +Event w all properties description + +Owner: Test codegen + +@param event The event +*/ +- (void)eventWithAllProperties:(EventWithAllProperties *)event; + +/** +Event With Array Types + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20Array%20Types) + +Description for event with Array Types + +Owner: Test codegen + +@param event The event +@param options Optional AMPEventOptions +*/ +- (void)eventWithArrayTypes:(EventWithArrayTypes *)event options:(AMPEventOptions *_Nullable)options; + +/** +Event With Array Types + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20Array%20Types) + +Description for event with Array Types + +Owner: Test codegen + +@param event The event +*/ +- (void)eventWithArrayTypes:(EventWithArrayTypes *)event; + +/** +Event With Const Types + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20Const%20Types) + +Description for event with const types + +Owner: Test codegen + +@param options Optional AMPEventOptions +*/ +- (void)eventWithConstTypes:(AMPEventOptions *_Nullable)options; + +/** +Event With Const Types + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20Const%20Types) + +Description for event with const types + +Owner: Test codegen + +*/ +- (void)eventWithConstTypes; + +/** +Event With Enum Types + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20Enum%20Types) + +Description for event with enum types + +Owner: Test codegen + +@param event The event +@param options Optional AMPEventOptions +*/ +- (void)eventWithEnumTypes:(EventWithEnumTypes *)event options:(AMPEventOptions *_Nullable)options; + +/** +Event With Enum Types + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20Enum%20Types) + +Description for event with enum types + +Owner: Test codegen + +@param event The event +*/ +- (void)eventWithEnumTypes:(EventWithEnumTypes *)event; + +/** +Event With Optional Array Types + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20Optional%20Array%20Types) + +Description for event with optional array types + +Owner: Test codegen + +@param event The event +@param options Optional AMPEventOptions +*/ +- (void)eventWithOptionalArrayTypes:(EventWithOptionalArrayTypes *)event options:(AMPEventOptions *_Nullable)options; + +/** +Event With Optional Array Types + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20Optional%20Array%20Types) + +Description for event with optional array types + +Owner: Test codegen + +@param event The event +*/ +- (void)eventWithOptionalArrayTypes:(EventWithOptionalArrayTypes *)event; + +/** +Event With Optional Properties + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20Optional%20Properties) + +Event w optional properties description + +Owner: Test codegen + +@param event The event +@param options Optional AMPEventOptions +*/ +- (void)eventWithOptionalProperties:(EventWithOptionalProperties *)event options:(AMPEventOptions *_Nullable)options; + +/** +Event With Optional Properties + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20Optional%20Properties) + +Event w optional properties description + +Owner: Test codegen + +@param event The event +*/ +- (void)eventWithOptionalProperties:(EventWithOptionalProperties *)event; + +/** +Event With Template Properties + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20Template%20Properties) + +Event with template properties description + +Owner: Test codegen + +@param event The event +@param options Optional AMPEventOptions +*/ +- (void)eventWithTemplateProperties:(EventWithTemplateProperties *)event options:(AMPEventOptions *_Nullable)options; + +/** +Event With Template Properties + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/Event%20With%20Template%20Properties) + +Event with template properties description + +Owner: Test codegen + +@param event The event +*/ +- (void)eventWithTemplateProperties:(EventWithTemplateProperties *)event; + +/** +event withDifferent_CasingTypes + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/event%20withDifferent_CasingTypes) + +Description for case with space + +Owner: Test codegen + +@param event The event +@param options Optional AMPEventOptions +*/ +- (void)eventWithDifferentCasingTypes:(EventWithDifferentCasingTypes *)event options:(AMPEventOptions *_Nullable)options; + +/** +event withDifferent_CasingTypes + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/event%20withDifferent_CasingTypes) + +Description for case with space + +Owner: Test codegen + +@param event The event +*/ +- (void)eventWithDifferentCasingTypes:(EventWithDifferentCasingTypes *)event; + +/** +EventMaxIntForTest + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/EventMaxIntForTest) + +Event to test schema validation + +Owner: Test codegen + +@param event The event +@param options Optional AMPEventOptions +*/ +- (void)eventMaxIntForTest:(EventMaxIntForTest *)event options:(AMPEventOptions *_Nullable)options; + +/** +EventMaxIntForTest + +[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/EventMaxIntForTest) + +Event to test schema validation + +Owner: Test codegen + +@param event The event +*/ +- (void)eventMaxIntForTest:(EventMaxIntForTest *)event; +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.m b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.m new file mode 100644 index 00000000..4ee2b363 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.m @@ -0,0 +1,811 @@ +/** + * Ampli - A strong typed wrapper for your Analytics + * + * This file is generated by Amplitude. + * To update run 'ampli pull obj-c-ampli-v2' + * + * Required dependencies: AmplitudeSwift ~> 0.7.1 + * Tracking Plan Version: 1 + * Build: 1.0.0 + * Runtime: ios:obj-c-ampli-v2 + * + * [View Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest) + * + * [Full Setup Instructions](https://data.amplitude.com/test-codegen/Test%20Codegen/implementation/obj-c-ampli-v2) + */ + +#import +@import AmplitudeSwift; +#import "Ampli.h" + +@implementation Event: NSObject + +- (instancetype)initWithEventType: (NSString *) eventType eventProperties: (NSDictionary *) eventProperties { + _eventType = eventType; + _eventProperties = [self removeNullValues:eventProperties]; + return self; +} + +- (instancetype)initWithEventType: (NSString *) eventType eventProperties: (NSDictionary *) eventProperties options:(AMPEventOptions*)options { + _eventType = eventType; + _eventProperties = [self removeNullValues:eventProperties]; + _options = options; + return self; +} + +- (NSDictionary *)removeNullValues:(NSDictionary *)dict { + if (dict == nil) { + return nil; + } + NSMutableDictionary *copy = [dict mutableCopy]; + NSArray *keysForNullValues = [copy allKeysForObject:[NSNull null]]; + [copy removeObjectsForKeys:keysForNullValues]; + return copy; +} + +@end + +#pragma mark - IdentifyBuilder + +@implementation IdentifyBuilder: NSObject +-(instancetype)init { + if (self = [super init]) { + self.optionalArray = nil; + } + return self; +} +@end + +#pragma mark - Identify + +@implementation Identify: Event + ++ (instancetype)requiredNumber:(Float64)requiredNumber { + return [self requiredNumber: requiredNumber + builderBlock:^(IdentifyBuilder * b) {}]; +} ++ (instancetype)requiredNumber:(Float64)requiredNumber builderBlock:(void (^)(IdentifyBuilder *b))builderBlock { + IdentifyBuilder *options = [IdentifyBuilder new]; + builderBlock(options); + return [[self alloc] initWithRequiredNumber_Identify: requiredNumber + optionalArray: options.optionalArray]; +} + +- (instancetype)initWithRequiredNumber_Identify:(Float64)requiredNumber +optionalArray:(NSArray * _Nullable)optionalArray { + self = [super initWithEventType:@"$identify" + eventProperties:@{ + @"optionalArray": optionalArray ?: NSNull.null, + @"requiredNumber": @(requiredNumber) + }]; + return self; +} +@end + +#pragma mark - EventNoProperties + +@implementation EventNoProperties: Event +- (instancetype)init { + self = [super initWithEventType:@"Event No Properties" + eventProperties:@{}]; + return self; +} +@end + +#pragma mark - EventObjectTypes + +@implementation EventObjectTypes: Event + ++ (instancetype)requiredObject:(NSDictionary *)requiredObject requiredObjectArray:(NSArray *> *)requiredObjectArray { + return [[self alloc] initWithRequiredObject_EventObjectTypes: requiredObject + requiredObjectArray: requiredObjectArray]; +} + +- (instancetype)initWithRequiredObject_EventObjectTypes:(NSDictionary *)requiredObject +requiredObjectArray:(NSArray *> *)requiredObjectArray { + self = [super initWithEventType:@"Event Object Types" + eventProperties:@{ + @"requiredObject": requiredObject, + @"requiredObjectArray": requiredObjectArray + }]; + return self; +} +@end + +#pragma mark - EventWithAllPropertiesBuilder + +@implementation EventWithAllPropertiesBuilder: NSObject +-(instancetype)init { + if (self = [super init]) { + self.optionalString = nil; + } + return self; +} +@end + +#pragma mark - EventWithAllProperties + +@implementation EventWithAllProperties: Event + ++ (instancetype)requiredArray:(NSArray *)requiredArray requiredBoolean:(Boolean)requiredBoolean requiredEnum:(EventWithAllPropertiesRequiredEnum)requiredEnum requiredInteger:(NSInteger)requiredInteger requiredNumber:(Float64)requiredNumber requiredString:(NSString*)requiredString { + return [self requiredArray: requiredArray + requiredBoolean: requiredBoolean + requiredEnum: requiredEnum + requiredInteger: requiredInteger + requiredNumber: requiredNumber + requiredString: requiredString + builderBlock:^(EventWithAllPropertiesBuilder * b) {}]; +} ++ (instancetype)requiredArray:(NSArray *)requiredArray requiredBoolean:(Boolean)requiredBoolean requiredEnum:(EventWithAllPropertiesRequiredEnum)requiredEnum requiredInteger:(NSInteger)requiredInteger requiredNumber:(Float64)requiredNumber requiredString:(NSString*)requiredString builderBlock:(void (^)(EventWithAllPropertiesBuilder *b))builderBlock { + EventWithAllPropertiesBuilder *options = [EventWithAllPropertiesBuilder new]; + builderBlock(options); + return [[self alloc] initWithRequiredArray_EventWithAllProperties: requiredArray + requiredBoolean: requiredBoolean + requiredEnum: requiredEnum + requiredInteger: requiredInteger + requiredNumber: requiredNumber + requiredString: requiredString + optionalString: options.optionalString]; +} + +- (instancetype)initWithRequiredArray_EventWithAllProperties:(NSArray *)requiredArray +requiredBoolean:(Boolean)requiredBoolean +requiredEnum:(EventWithAllPropertiesRequiredEnum)requiredEnum +requiredInteger:(NSInteger)requiredInteger +requiredNumber:(Float64)requiredNumber +requiredString:(NSString*)requiredString +optionalString:(NSString* _Nullable)optionalString { + self = [super initWithEventType:@"Event With All Properties" + eventProperties:@{ + @"optionalString": optionalString ?: NSNull.null, + @"requiredArray": requiredArray, + @"requiredBoolean": [NSNumber numberWithBool:requiredBoolean], + @"requiredConst": @"some-const-value", + @"requiredEnum": [EventWithAllProperties stringFromRequiredEnum: requiredEnum], + @"requiredInteger": @(requiredInteger), + @"requiredNumber": @(requiredNumber), + @"requiredString": requiredString + }]; + return self; +} + ++ (NSString * _Nullable)stringFromRequiredEnum:(EventWithAllPropertiesRequiredEnum)enumValue { + switch (enumValue) { + case EventWithAllPropertiesRequiredEnumEnum1: + return @"Enum1"; + case EventWithAllPropertiesRequiredEnumEnum2: + return @"Enum2"; + } +} +@end + +#pragma mark - EventWithArrayTypes + +@implementation EventWithArrayTypes: Event + ++ (instancetype)requiredBooleanArray:(NSArray *)requiredBooleanArray requiredEnumArray:(NSArray *)requiredEnumArray requiredNumberArray:(NSArray *)requiredNumberArray requiredObjectArray:(NSArray *> *)requiredObjectArray requiredStringArray:(NSArray *)requiredStringArray { + return [[self alloc] initWithRequiredBooleanArray_EventWithArrayTypes: requiredBooleanArray + requiredEnumArray: requiredEnumArray + requiredNumberArray: requiredNumberArray + requiredObjectArray: requiredObjectArray + requiredStringArray: requiredStringArray]; +} + +- (instancetype)initWithRequiredBooleanArray_EventWithArrayTypes:(NSArray *)requiredBooleanArray +requiredEnumArray:(NSArray *)requiredEnumArray +requiredNumberArray:(NSArray *)requiredNumberArray +requiredObjectArray:(NSArray *> *)requiredObjectArray +requiredStringArray:(NSArray *)requiredStringArray { + self = [super initWithEventType:@"Event With Array Types" + eventProperties:@{ + @"requiredBooleanArray": requiredBooleanArray, + @"requiredEnumArray": requiredEnumArray, + @"requiredNumberArray": requiredNumberArray, + @"requiredObjectArray": requiredObjectArray, + @"requiredStringArray": requiredStringArray + }]; + return self; +} +@end + +#pragma mark - EventWithConstTypes + +@implementation EventWithConstTypes: Event +- (instancetype)init { + self = [super initWithEventType:@"Event With Const Types" + eventProperties:@{ + @"Boolean Const": @YES, + @"Integer Const": @10, + @"Number Const": @2.2, + @"String Const": @"String-Constant", + @"String Const WIth Quotes": @"\"String \"Const With\" Quotes\"", + @"String Int Const": @0 + }]; + return self; +} +@end + +#pragma mark - EventWithEnumTypesBuilder + +@implementation EventWithEnumTypesBuilder: NSObject +-(instancetype)init { + if (self = [super init]) { + self.optionalEnum = EventWithEnumTypesOptionalEnumUndefined; + } + return self; +} +@end + +#pragma mark - EventWithEnumTypes + +@implementation EventWithEnumTypes: Event + ++ (instancetype)requiredEnum:(EventWithEnumTypesRequiredEnum)requiredEnum { + return [self requiredEnum: requiredEnum + builderBlock:^(EventWithEnumTypesBuilder * b) {}]; +} ++ (instancetype)requiredEnum:(EventWithEnumTypesRequiredEnum)requiredEnum builderBlock:(void (^)(EventWithEnumTypesBuilder *b))builderBlock { + EventWithEnumTypesBuilder *options = [EventWithEnumTypesBuilder new]; + builderBlock(options); + return [[self alloc] initWithRequiredEnum_EventWithEnumTypes: requiredEnum + optionalEnum: options.optionalEnum]; +} + +- (instancetype)initWithRequiredEnum_EventWithEnumTypes:(EventWithEnumTypesRequiredEnum)requiredEnum +optionalEnum:(EventWithEnumTypesOptionalEnum)optionalEnum { + self = [super initWithEventType:@"Event With Enum Types" + eventProperties:@{ + @"optional enum": [EventWithEnumTypes stringFromOptionalEnum: optionalEnum] ?: NSNull.null, + @"required enum": [EventWithEnumTypes stringFromRequiredEnum: requiredEnum] + }]; + return self; +} + ++ (NSString * _Nullable)stringFromOptionalEnum:(EventWithEnumTypesOptionalEnum)enumValue { + switch (enumValue) { + case EventWithEnumTypesOptionalEnumOptionalEnum1: + return @"optional enum 1"; + case EventWithEnumTypesOptionalEnumOptionalEnum2: + return @"optional enum 2"; + case EventWithEnumTypesOptionalEnumUndefined: + return nil; + } +} + ++ (NSString * _Nullable)stringFromRequiredEnum:(EventWithEnumTypesRequiredEnum)enumValue { + switch (enumValue) { + case EventWithEnumTypesRequiredEnumRequiredEnum1: + return @"required enum 1"; + case EventWithEnumTypesRequiredEnumRequiredEnum2: + return @"required enum 2"; + } +} +@end + +#pragma mark - EventWithOptionalArrayTypesBuilder + +@implementation EventWithOptionalArrayTypesBuilder: NSObject +-(instancetype)init { + if (self = [super init]) { + self.optionalBooleanArray = nil; + self.optionalEnumArray = nil; + self.optionalJsonArray = nil; + self.optionalNumberArray = nil; + self.optionalStringArray = nil; + } + return self; +} +@end + +#pragma mark - EventWithOptionalArrayTypes + +@implementation EventWithOptionalArrayTypes: Event + ++ (instancetype) builderBlock:(void (^)(EventWithOptionalArrayTypesBuilder *b))builderBlock { + EventWithOptionalArrayTypesBuilder *options = [EventWithOptionalArrayTypesBuilder new]; + builderBlock(options); + return [[self alloc] initWithOptionalBooleanArray_EventWithOptionalArrayTypes: options.optionalBooleanArray + optionalEnumArray: options.optionalEnumArray + optionalJsonArray: options.optionalJsonArray + optionalNumberArray: options.optionalNumberArray + optionalStringArray: options.optionalStringArray]; +} + +- (instancetype)initWithOptionalBooleanArray_EventWithOptionalArrayTypes:(NSArray * _Nullable)optionalBooleanArray +optionalEnumArray:(NSArray * _Nullable)optionalEnumArray +optionalJsonArray:(NSArray *> * _Nullable)optionalJsonArray +optionalNumberArray:(NSArray * _Nullable)optionalNumberArray +optionalStringArray:(NSArray * _Nullable)optionalStringArray { + self = [super initWithEventType:@"Event With Optional Array Types" + eventProperties:@{ + @"optionalBooleanArray": optionalBooleanArray ?: NSNull.null, + @"optionalEnumArray": optionalEnumArray ?: NSNull.null, + @"optionalJSONArray": optionalJsonArray ?: NSNull.null, + @"optionalNumberArray": optionalNumberArray ?: NSNull.null, + @"optionalStringArray": optionalStringArray ?: NSNull.null + }]; + return self; +} + +- (instancetype)init { + return [self initWithOptionalBooleanArray_EventWithOptionalArrayTypes:nil + optionalEnumArray:nil + optionalJsonArray:nil + optionalNumberArray:nil + optionalStringArray:nil]; +} +@end + +#pragma mark - EventWithOptionalPropertiesBuilder + +@implementation EventWithOptionalPropertiesBuilder: NSObject +-(instancetype)init { + if (self = [super init]) { + self.optionalArrayNumber = nil; + self.optionalArrayString = nil; + self.optionalString = nil; + } + return self; +} +@end + +#pragma mark - EventWithOptionalProperties + +@implementation EventWithOptionalProperties: Event + ++ (instancetype) builderBlock:(void (^)(EventWithOptionalPropertiesBuilder *b))builderBlock { + EventWithOptionalPropertiesBuilder *options = [EventWithOptionalPropertiesBuilder new]; + builderBlock(options); + return [[self alloc] initWithOptionalArrayNumber_EventWithOptionalProperties: options.optionalArrayNumber + optionalArrayString: options.optionalArrayString + optionalBoolean: options.optionalBoolean + optionalNumber: options.optionalNumber + optionalString: options.optionalString]; +} + +- (instancetype)initWithOptionalArrayNumber_EventWithOptionalProperties:(NSArray * _Nullable)optionalArrayNumber +optionalArrayString:(NSArray * _Nullable)optionalArrayString +optionalBoolean:(NSNumber * _Nullable)optionalBoolean +optionalNumber:(NSNumber * _Nullable)optionalNumber +optionalString:(NSString* _Nullable)optionalString { + self = [super initWithEventType:@"Event With Optional Properties" + eventProperties:@{ + @"optionalArrayNumber": optionalArrayNumber ?: NSNull.null, + @"optionalArrayString": optionalArrayString ?: NSNull.null, + @"optionalBoolean": optionalBoolean ?: NSNull.null, + @"optionalNumber": optionalNumber ?: NSNull.null, + @"optionalString": optionalString ?: NSNull.null + }]; + return self; +} + +- (instancetype)init { + return [self initWithOptionalArrayNumber_EventWithOptionalProperties:nil + optionalArrayString:nil + optionalBoolean:nil + optionalNumber:nil + optionalString:nil]; +} +@end + +#pragma mark - EventWithTemplatePropertiesBuilder + +@implementation EventWithTemplatePropertiesBuilder: NSObject +-(instancetype)init { + if (self = [super init]) { + + } + return self; +} +@end + +#pragma mark - EventWithTemplateProperties + +@implementation EventWithTemplateProperties: Event + ++ (instancetype)requiredEventProperty:(NSString*)requiredEventProperty requiredTemplateProperty:(NSString*)requiredTemplateProperty { + return [self requiredEventProperty: requiredEventProperty + requiredTemplateProperty: requiredTemplateProperty + builderBlock:^(EventWithTemplatePropertiesBuilder * b) {}]; +} ++ (instancetype)requiredEventProperty:(NSString*)requiredEventProperty requiredTemplateProperty:(NSString*)requiredTemplateProperty builderBlock:(void (^)(EventWithTemplatePropertiesBuilder *b))builderBlock { + EventWithTemplatePropertiesBuilder *options = [EventWithTemplatePropertiesBuilder new]; + builderBlock(options); + return [[self alloc] initWithRequiredEventProperty_EventWithTemplateProperties: requiredEventProperty + requiredTemplateProperty: requiredTemplateProperty + optionalEventProperty: options.optionalEventProperty + optionalTemplateProperty: options.optionalTemplateProperty]; +} + +- (instancetype)initWithRequiredEventProperty_EventWithTemplateProperties:(NSString*)requiredEventProperty +requiredTemplateProperty:(NSString*)requiredTemplateProperty +optionalEventProperty:(NSNumber * _Nullable)optionalEventProperty +optionalTemplateProperty:(NSNumber * _Nullable)optionalTemplateProperty { + self = [super initWithEventType:@"Event With Template Properties" + eventProperties:@{ + @"optional_event_property": optionalEventProperty ?: NSNull.null, + @"optional_template_property": optionalTemplateProperty ?: NSNull.null, + @"required_event_property": requiredEventProperty, + @"required_template_property": requiredTemplateProperty + }]; + return self; +} +@end + +#pragma mark - EventWithDifferentCasingTypes + +@implementation EventWithDifferentCasingTypes: Event + ++ (instancetype)enumWithSpace:(EventWithDifferentCasingTypesEnumWithSpace)enumWithSpace enumSnakeCase:(EventWithDifferentCasingTypesEnumSnakeCase)enumSnakeCase enumCamelCase:(EventWithDifferentCasingTypesEnumCamelCase)enumCamelCase enumPascalCase:(EventWithDifferentCasingTypesEnumPascalCase)enumPascalCase propertyWithSpace:(NSString*)propertyWithSpace propertyWithSnakeCase:(NSString*)propertyWithSnakeCase propertyWithCamelCase:(NSString*)propertyWithCamelCase propertyWithPascalCase:(NSString*)propertyWithPascalCase { + return [[self alloc] initWithEnumWithSpace_EventWithDifferentCasingTypes: enumWithSpace + enumSnakeCase: enumSnakeCase + enumCamelCase: enumCamelCase + enumPascalCase: enumPascalCase + propertyWithSpace: propertyWithSpace + propertyWithSnakeCase: propertyWithSnakeCase + propertyWithCamelCase: propertyWithCamelCase + propertyWithPascalCase: propertyWithPascalCase]; +} + +- (instancetype)initWithEnumWithSpace_EventWithDifferentCasingTypes:(EventWithDifferentCasingTypesEnumWithSpace)enumWithSpace +enumSnakeCase:(EventWithDifferentCasingTypesEnumSnakeCase)enumSnakeCase +enumCamelCase:(EventWithDifferentCasingTypesEnumCamelCase)enumCamelCase +enumPascalCase:(EventWithDifferentCasingTypesEnumPascalCase)enumPascalCase +propertyWithSpace:(NSString*)propertyWithSpace +propertyWithSnakeCase:(NSString*)propertyWithSnakeCase +propertyWithCamelCase:(NSString*)propertyWithCamelCase +propertyWithPascalCase:(NSString*)propertyWithPascalCase { + self = [super initWithEventType:@"event withDifferent_CasingTypes" + eventProperties:@{ + @"enum with space": [EventWithDifferentCasingTypes stringFromEnumWithSpace: enumWithSpace], + @"enum_snake_case": [EventWithDifferentCasingTypes stringFromEnumSnakeCase: enumSnakeCase], + @"enumCamelCase": [EventWithDifferentCasingTypes stringFromEnumCamelCase: enumCamelCase], + @"EnumPascalCase": [EventWithDifferentCasingTypes stringFromEnumPascalCase: enumPascalCase], + @"property with space": propertyWithSpace, + @"property_with_snake_case": propertyWithSnakeCase, + @"propertyWithCamelCase": propertyWithCamelCase, + @"PropertyWithPascalCase": propertyWithPascalCase + }]; + return self; +} + ++ (NSString * _Nullable)stringFromEnumWithSpace:(EventWithDifferentCasingTypesEnumWithSpace)enumValue { + switch (enumValue) { + case EventWithDifferentCasingTypesEnumWithSpaceEnumWithSpace: + return @"enum with space"; + } +} + ++ (NSString * _Nullable)stringFromEnumSnakeCase:(EventWithDifferentCasingTypesEnumSnakeCase)enumValue { + switch (enumValue) { + case EventWithDifferentCasingTypesEnumSnakeCaseEnumSnakeCase: + return @"enum_snake_case"; + } +} + ++ (NSString * _Nullable)stringFromEnumCamelCase:(EventWithDifferentCasingTypesEnumCamelCase)enumValue { + switch (enumValue) { + case EventWithDifferentCasingTypesEnumCamelCaseEnumCamelCase: + return @"enumCamelCase"; + } +} + ++ (NSString * _Nullable)stringFromEnumPascalCase:(EventWithDifferentCasingTypesEnumPascalCase)enumValue { + switch (enumValue) { + case EventWithDifferentCasingTypesEnumPascalCaseEnumPascalCase: + return @"EnumPascalCase"; + } +} +@end + +#pragma mark - EventMaxIntForTest + +@implementation EventMaxIntForTest: Event + ++ (instancetype)intMax10:(NSInteger)intMax10 { + return [[self alloc] initWithIntMax10_EventMaxIntForTest: intMax10]; +} + +- (instancetype)initWithIntMax10_EventMaxIntForTest:(NSInteger)intMax10 { + self = [super initWithEventType:@"EventMaxIntForTest" + eventProperties:@{ + @"intMax10": @(intMax10) + }]; + return self; +} +@end + +@implementation LoadClientOptions + ++ (instancetype) initWithApiKey:(NSString*)apiKey { + return [[LoadClientOptions alloc] initWithApiKey:apiKey]; +} + ++ (instancetype) initWithInstance:(Amplitude*)instance { + return [[LoadClientOptions alloc] initWithInstance:instance]; +} + ++ (instancetype) initWithConfiguration:(AMPConfiguration*)configuration { + return [[LoadClientOptions alloc] initWithConfiguration:configuration]; +} + +- (instancetype) initWithApiKey:(NSString*)apiKey { + _configuration = [AMPConfiguration initWithApiKey:apiKey]; + return self; +} + +- (instancetype) initWithInstance:(Amplitude*)instance { + _instance = instance; + return self; +} + +- (instancetype) initWithConfiguration:(AMPConfiguration*)configuration { + _configuration = configuration; + return self; +} + +@end + +@implementation LoadOptions + ++ (instancetype) initWithApiKey:(NSString*)apiKey { + LoadClientOptions* client = [LoadClientOptions initWithApiKey:apiKey]; + return [[LoadOptions alloc] initWithClientOptions:client]; +} + ++ (instancetype) initWithEnvironment:(AmpliEnvironment)environment { + return [[LoadOptions alloc] initWithEnvironment:environment]; +} + ++ (instancetype) initWithClientOptions:(LoadClientOptions*)client { + return [[LoadOptions alloc] initWithClientOptions:client]; +} + ++ (instancetype) initWithDisabled:(BOOL)disabled { + return [[LoadOptions alloc] initWithDisabled:disabled]; +} + +- (instancetype) initWithClientOptions:(LoadClientOptions*)client { + _client = client; + return self; +} + +- (instancetype) initWithEnvironment:(AmpliEnvironment)environment { + _environment = environment; + return self; +} + +- (instancetype) initWithDisabled:(BOOL)disabled { + _disabled = disabled; + return self; +} + +@end + +@implementation Ampli + ++ (instancetype)instance { + static Ampli* ampli = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + ampli = [[self alloc] init]; + }); + return ampli; +} + +- (instancetype)init { + self = [super init]; + if (self) { + _disabled = NO; + } + return self; +} + +- (void)load { + [self load:nil]; +} + +/** + * options should have 'environment', 'client.api_key' or 'client.instance' + */ +- (void)load:(LoadOptions*)options { + NSDictionary* ApiKey = @{ + @(prod): @"", + @(dev): @"" + }; + self.disabled = options.disabled; + if (self.isLoaded) { + NSLog(@"Warning: Ampli is already initialized. Ampli.instance.load() should be called once at application start up."); + return; + } + + AmpliEnvironment env = options.environment; + NSString* apiKey = options.client != nil && options.client.configuration != nil && options.client.configuration.apiKey != nil + ? options.client.configuration.apiKey + : ApiKey[@(env)]; + + if (options.client != nil && options.client.instance != nil) { + _client = options.client.instance; + } else if (apiKey != nil) { + AMPConfiguration* configuration = options.client != nil ? options.client.configuration : nil; + if (configuration == nil) { + configuration = [AMPConfiguration initWithApiKey:apiKey]; + } + _client = [Amplitude initWithConfiguration:configuration]; + } else { + NSLog(@"ampli.load() requires 'environment', 'client.apiKey', or 'client.instance'"); + return; + } + + if (_client != nil) { + _isLoaded = YES; + + if (_client.configuration.plan == nil) { + AMPPlan* plan = [AMPPlan new]; + plan.branch = @"main"; + plan.source = @"obj-c-ampli-v2"; + plan.version = @"1"; + plan.versionId = @"a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c"; + _client.configuration.plan = plan; + } + + if (_client.configuration.ingestionMetadata == nil) { + AMPIngestionMetadata* ingestionMetadata = [AMPIngestionMetadata new]; + ingestionMetadata.sourceName = @"ios-objective-c-ampli-v2"; + ingestionMetadata.sourceVersion = @"1.0.0"; + _client.configuration.ingestionMetadata = ingestionMetadata; + } + } +} + +- (void)track:(Event*)event { + [self track:event options:nil]; +} + +- (void)track:(Event*)event options:(AMPEventOptions* _Nullable)options { + if (![self isInitializedAndEnabled]) { + return; + } + AMPEventOptions* eventOptions = [self getEventOptions:event.options overrideOptions:options overrideUserId:nil]; + [self.client track:event.eventType eventProperties:event.eventProperties options:eventOptions]; +} + +- (void)identify:(NSString* _Nullable)userId event:(Identify*)event { + [self identify:userId event:event options:nil]; +} + +- (void)identify:(NSString* _Nullable)userId event:(Identify*)event options:(AMPEventOptions* _Nullable)options { + if (![self isInitializedAndEnabled]) { + return; + } + + AMPIdentify* identify = [AMPIdentify new]; + if (event.eventProperties != nil) { + [event.eventProperties enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL* stop) { + [identify set:key value:value]; + }]; + } + AMPEventOptions* eventOptions = [self getEventOptions:event.options overrideOptions:options overrideUserId:userId]; + [self.client identify:identify options:eventOptions]; + } + +- (void)flush { + if (![self isInitializedAndEnabled]) { + return; + } + if (self.client != nil) { + [self.client flush]; + } +} + +- (void)eventNoProperties:(AMPEventOptions *_Nullable)options { + [self track:[EventNoProperties new] options:options]; +} + +- (void)eventNoProperties { + [self track:[EventNoProperties new]]; +} + +- (void)eventObjectTypes:(EventObjectTypes *)event options:(AMPEventOptions *_Nullable)options { + [self track:event options:options]; +} + +- (void)eventObjectTypes:(EventObjectTypes *)event { + [self track:event]; +} + +- (void)eventWithAllProperties:(EventWithAllProperties *)event options:(AMPEventOptions *_Nullable)options { + [self track:event options:options]; +} + +- (void)eventWithAllProperties:(EventWithAllProperties *)event { + [self track:event]; +} + +- (void)eventWithArrayTypes:(EventWithArrayTypes *)event options:(AMPEventOptions *_Nullable)options { + [self track:event options:options]; +} + +- (void)eventWithArrayTypes:(EventWithArrayTypes *)event { + [self track:event]; +} + +- (void)eventWithConstTypes:(AMPEventOptions *_Nullable)options { + [self track:[EventWithConstTypes new] options:options]; +} + +- (void)eventWithConstTypes { + [self track:[EventWithConstTypes new]]; +} + +- (void)eventWithEnumTypes:(EventWithEnumTypes *)event options:(AMPEventOptions *_Nullable)options { + [self track:event options:options]; +} + +- (void)eventWithEnumTypes:(EventWithEnumTypes *)event { + [self track:event]; +} + +- (void)eventWithOptionalArrayTypes:(EventWithOptionalArrayTypes *)event options:(AMPEventOptions *_Nullable)options { + [self track:event options:options]; +} + +- (void)eventWithOptionalArrayTypes:(EventWithOptionalArrayTypes *)event { + [self track:event]; +} + +- (void)eventWithOptionalProperties:(EventWithOptionalProperties *)event options:(AMPEventOptions *_Nullable)options { + [self track:event options:options]; +} + +- (void)eventWithOptionalProperties:(EventWithOptionalProperties *)event { + [self track:event]; +} + +- (void)eventWithTemplateProperties:(EventWithTemplateProperties *)event options:(AMPEventOptions *_Nullable)options { + [self track:event options:options]; +} + +- (void)eventWithTemplateProperties:(EventWithTemplateProperties *)event { + [self track:event]; +} + +- (void)eventWithDifferentCasingTypes:(EventWithDifferentCasingTypes *)event options:(AMPEventOptions *_Nullable)options { + [self track:event options:options]; +} + +- (void)eventWithDifferentCasingTypes:(EventWithDifferentCasingTypes *)event { + [self track:event]; +} + +- (void)eventMaxIntForTest:(EventMaxIntForTest *)event options:(AMPEventOptions *_Nullable)options { + [self track:event options:options]; +} + +- (void)eventMaxIntForTest:(EventMaxIntForTest *)event { + [self track:event]; +} + +- (BOOL)isInitializedAndEnabled { + if (!self.isLoaded) { + NSLog(@"Ampli is not yet initialized. Have you called 'ampli.load()' on app start?"); + return NO; + } + return !self.disabled; +} + +- (AMPEventOptions*) getEventOptions:(AMPEventOptions*)options overrideOptions:(AMPEventOptions*)overrideOptions overrideUserId:(NSString*)overrideUserId { + AMPEventOptions* eventOptions = [AMPEventOptions new]; + if (options != nil) { + [eventOptions mergeEventOptions:options]; + } + if (overrideOptions != nil) { + [eventOptions mergeEventOptions:overrideOptions]; + } + if (overrideUserId != nil) { + eventOptions.userId = overrideUserId; + } + return eventOptions; +} + +@end diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.h b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.h new file mode 100644 index 00000000..9f8e55a2 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.h @@ -0,0 +1,14 @@ +// +// AppDelegate.h +// AmpliObjectiveCSampleApp +// +// Created by Qingzhuo Zhen on 11/24/21. +// + +#import + +@interface AppDelegate : UIResponder + + +@end + diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.m b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.m new file mode 100644 index 00000000..ce16ff73 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.m @@ -0,0 +1,167 @@ +// +// AppDelegate.m +// AmpliObjectiveCSampleApp +// +// Created by Qingzhuo Zhen on 11/24/21. +// + +#import "AppDelegate.h" +#import "Ampli.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + /* + * '[Ampli instance]' is the default instance of Ampli + * + * When you pull your tracking plan you can use the defaults and call load() without arguments + * This requires connecting your account via `ampli pull` which will set you API key in the generated Ampli SDK + */ + // [Ampli.instance] + + /* + * OR Specify a AmpliEnvironment + */ + // [Ampli.instance load:[LoadOptions initWithEnvironment:dev]]; + + /* + * OR Provide a specific Amplitude API key + */ + // [Ampli.instance load:[LoadOptions initWithApiKey:@"Custom api key"]]; + + /* + * OR Use an existing Amplitude instance + * requires `@import AmplitudeSwift;` + */ + // AMPConfiguration* configuration = [AMPConfiguration initWithApiKey:@"Custom api key" instanceName:@"instanceName"]; + // Amplitude* client = [Amplitude initWithConfiguration:configuration]; + // LoadClientOptions* clientOptions = [LoadClientOptions initWithInstance:client]; + // [Ampli.instance load:[LoadOptions initWithClientOptions:clientOptions]]; + + /* + * For testing you can disable Ampli + */ + // [Ampli.instance load:[LoadOptions initWithDisabled:ENV.IS_TESTING ? YES : NO]]; + + /* + * Make as many Ampli instances as you want + */ + // Ampli* ampli2 = [Ampli new]; + // [ampli2 load:[LoadOptions initWithApiKey:@"Custom api key"]]; + + NSString *apiKey = [[[NSProcessInfo processInfo] environment] objectForKey:@"AMPLITUDE_API_KEY"]; + Ampli *ampli = [Ampli instance]; + + // Load + [ampli load:[LoadOptions initWithApiKey:apiKey]]; + + // Add Plugin + [ampli.client add:[AMPPlugin initWithType:AMPPluginTypeDestination execute:^AMPBaseEvent* _Nullable(AMPBaseEvent* _Nonnull event) { + NSString *logString = [NSString stringWithFormat:@"event_type=%@", event.eventType]; + NSLog(@"[ampli] %@", logString); + return event; + }]]; + + // Identify + [ampli identify:@"ampli-objc-user" event:[Identify requiredNumber: 1.23F builderBlock:^(IdentifyBuilder *b) { + b.optionalArray = [NSArray arrayWithObjects:@"optional string", nil]; + }]]; + + // Set Group + [ampli.client setGroup:@"ampli group type" groupName:@"ampli objective-c group"]; + + // GroupIdentify + AMPIdentify *identifyArgs = [AMPIdentify new]; + [identifyArgs set:@"requiredBoolean" value:@true]; + [identifyArgs set:@"optionalString" value:@"optional string"]; + [ampli.client groupIdentify:@"ampli group type" groupName:@"ampli objective-c group" identify:identifyArgs]; + + // Track events with dedicated event methods + [ampli eventNoProperties]; + + [ampli eventMaxIntForTest:[EventMaxIntForTest intMax10: 5]]; + [ampli track:[EventMaxIntForTest intMax10: 20]]; + + [ampli eventWithConstTypes]; + + [ampli track:[EventWithAllProperties requiredArray:@[@"I'm required"] + requiredBoolean:true + requiredEnum:EventWithAllPropertiesRequiredEnumEnum2 + requiredInteger:1 + requiredNumber:4.2 + requiredString:@"I'm also required" + builderBlock:^(EventWithAllPropertiesBuilder * b) { + b.optionalString = @"I'm optional"; + }]]; + + [ampli eventWithAllProperties:[EventWithAllProperties requiredArray:@[@"I'm required"] + requiredBoolean:true + requiredEnum:EventWithAllPropertiesRequiredEnumEnum2 + requiredInteger:1 + requiredNumber:4.2 + requiredString:@"I'm also required" + builderBlock:^(EventWithAllPropertiesBuilder * b) { + b.optionalString = @"I'm optional"; + }]]; + + NSDictionary *obj = @{ @"key" : @true, @"key2" : @42 }; + + [ampli eventObjectTypes:[EventObjectTypes requiredObject:obj + requiredObjectArray:@[obj] + ]]; + + [ampli eventWithArrayTypes:[EventWithArrayTypes requiredBooleanArray:@[@true] + requiredEnumArray:@[@"Enum1"] + requiredNumberArray:@[@1.0] + requiredObjectArray:@[obj] + requiredStringArray:@[@"required"] + ]]; + + [ampli eventWithEnumTypes:[EventWithEnumTypes requiredEnum:EventWithEnumTypesRequiredEnumRequiredEnum2]]; + + [ampli eventWithOptionalArrayTypes:[EventWithOptionalArrayTypes new]]; + + [ampli eventWithOptionalProperties:[EventWithOptionalProperties new]]; + + [ampli eventWithTemplateProperties:[EventWithTemplateProperties requiredEventProperty:@"event property" + requiredTemplateProperty:@"template property" + ]]; + + [ampli eventWithDifferentCasingTypes:[EventWithDifferentCasingTypes enumWithSpace:EventWithDifferentCasingTypesEnumWithSpaceEnumWithSpace + enumSnakeCase:EventWithDifferentCasingTypesEnumSnakeCaseEnumSnakeCase + enumCamelCase:EventWithDifferentCasingTypesEnumCamelCaseEnumCamelCase + enumPascalCase:EventWithDifferentCasingTypesEnumPascalCaseEnumPascalCase + propertyWithSpace:@"property with space" + propertyWithSnakeCase:@"property with snake case" + propertyWithCamelCase:@"property with camel case" + propertyWithPascalCase:@"property with pascal case" + ]]; + + [ampli flush]; + return YES; +} + + +#pragma mark - UISceneSession lifecycle + + +- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; +} + + +- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. +} + + +@end diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..9221b9bb --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/Contents.json b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/LaunchScreen.storyboard b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..7872ae92 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/Main.storyboard b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/Main.storyboard new file mode 100644 index 00000000..3d053121 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/Main.storyboard @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Info.plist b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Info.plist new file mode 100644 index 00000000..81ed29b7 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Info.plist @@ -0,0 +1,25 @@ + + + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + SceneDelegate + UISceneStoryboardFile + Main + + + + + + diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.h b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.h new file mode 100644 index 00000000..15318f3f --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.h @@ -0,0 +1,15 @@ +// +// SceneDelegate.h +// AmpliObjectiveCSampleApp +// +// Created by Qingzhuo Zhen on 11/24/21. +// + +#import + +@interface SceneDelegate : UIResponder + +@property (strong, nonatomic) UIWindow * window; + +@end + diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.m b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.m new file mode 100644 index 00000000..3284705e --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.m @@ -0,0 +1,57 @@ +// +// SceneDelegate.m +// AmpliObjectiveCSampleApp +// +// Created by Qingzhuo Zhen on 11/24/21. +// + +#import "SceneDelegate.h" + +@interface SceneDelegate () + +@end + +@implementation SceneDelegate + + +- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). +} + + +- (void)sceneDidDisconnect:(UIScene *)scene { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). +} + + +- (void)sceneDidBecomeActive:(UIScene *)scene { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. +} + + +- (void)sceneWillResignActive:(UIScene *)scene { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). +} + + +- (void)sceneWillEnterForeground:(UIScene *)scene { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. +} + + +- (void)sceneDidEnterBackground:(UIScene *)scene { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. +} + + +@end diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.h b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.h new file mode 100644 index 00000000..2c97f1d0 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.h @@ -0,0 +1,14 @@ +// +// ViewController.h +// AmpliObjectiveCSampleApp +// +// Created by Qingzhuo Zhen on 11/24/21. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.m b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.m new file mode 100644 index 00000000..9af42797 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.m @@ -0,0 +1,22 @@ +// +// ViewController.m +// AmpliObjectiveCSampleApp +// +// Created by Qingzhuo Zhen on 11/24/21. +// + +#import "ViewController.h" +#import "Ampli.h" + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + [Ampli.instance eventMaxIntForTest:[EventMaxIntForTest intMax10: 10]]; +} + +@end diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/main.m b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/main.m new file mode 100644 index 00000000..2158f974 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/main.m @@ -0,0 +1,18 @@ +// +// main.m +// AmpliObjectiveCSampleApp +// +// Created by Qingzhuo Zhen on 11/24/21. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + NSString * appDelegateClassName; + @autoreleasepool { + // Setup code that might create autoreleased objects goes here. + appDelegateClassName = NSStringFromClass([AppDelegate class]); + } + return UIApplicationMain(argc, argv, nil, appDelegateClassName); +} diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleAppTests/AmpliTests.m b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleAppTests/AmpliTests.m new file mode 100644 index 00000000..97cdb578 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleAppTests/AmpliTests.m @@ -0,0 +1,211 @@ +// +// AmpliTests.m +// AmpliObjectiveCSampleAppTests +// +// Created by Qingzhuo Zhen on 12/2/21. +// + +#import +@import AmplitudeSwift; +#import "Ampli.h" + +@interface AmpliTests : XCTestCase +@property (nonatomic, strong) Ampli *ampli; +@property (nonatomic, weak) XCTestExpectation* pluginRun; +@end + +@implementation AmpliTests + +- (void)setUp { + _ampli = [Ampli new]; + _pluginRun = [self expectationWithDescription:@"Wait for plugin run"]; +} + +- (void) initAmpliWithNewInstance:(NSString *) instanceName { + AMPConfiguration* configuration = [AMPConfiguration initWithApiKey:@"test-api-key" instanceName:instanceName]; + configuration.defaultTracking = AMPDefaultTrackingOptions.NONE; + configuration.migrateLegacyData = false; + LoadClientOptions* clientOptions = [LoadClientOptions initWithConfiguration:configuration]; + [_ampli load:[LoadOptions initWithClientOptions:clientOptions]]; +} + +- (void)testTrackWithNoProperies { + [self initAmpliWithNewInstance:@"testTrackWithNoProperties"]; + + [_ampli.client add:[AMPPlugin initWithType:AMPPluginTypeBefore execute:^AMPBaseEvent* _Nullable(AMPBaseEvent* _Nonnull event) { + XCTAssertEqualObjects(event.eventType, @"Event No Properties"); + [self->_pluginRun fulfill]; + return event; + }]]; + + [_ampli eventNoProperties]; + [_ampli flush]; + + [self waitForExpectationsWithTimeout:1.0 handler:^(NSError *error) { + if (error) { + XCTFail(@"test timed out"); + } + }]; +} + +- (void)testTrackEventWithAllTypes { + [self initAmpliWithNewInstance:@"testTrackEventWithAllTypes"]; + + NSMutableDictionary *extraDict = [NSMutableDictionary new]; + [extraDict setObject:@"extra test" forKey:@"test"]; + NSArray *requiredArray = [NSArray arrayWithObjects:@"array element 1", @"array element 2", nil]; + + [_ampli.client add:[AMPPlugin initWithType:AMPPluginTypeBefore execute:^AMPBaseEvent* _Nullable(AMPBaseEvent* _Nonnull event) { + AMPProperties* eventProperties = event.eventProperties; + XCTAssertEqualObjects([eventProperties get:@"requiredArray"], requiredArray); + XCTAssertEqualObjects([eventProperties get:@"requiredBoolean"], @true); + XCTAssertEqualObjects([eventProperties get:@"requiredEnum"], @"Enum1"); + XCTAssertEqualObjects([eventProperties get:@"requiredInteger"], @10); + XCTAssertEqualObjects([eventProperties get:@"requiredNumber"], @2.0F); + XCTAssertEqualObjects([eventProperties get:@"requiredString"], @"required string"); + XCTAssertNil([eventProperties get:@"optionalString"]); + [self->_pluginRun fulfill]; + return event; + }]]; + + [_ampli track:[EventWithAllProperties requiredArray:requiredArray + requiredBoolean:true + requiredEnum:EventWithAllPropertiesRequiredEnumEnum1 + requiredInteger:10 + requiredNumber:2.0F + requiredString:@"required string" + ]]; + [_ampli flush]; + + [self waitForExpectationsWithTimeout:2.0 handler:^(NSError *error) { + if (error) { + NSLog(@"timeout errored: %@", error); + XCTFail(@"test timed out"); + } + }]; +} + +- (void)testIdentify { + [self initAmpliWithNewInstance:@"testIdentify"]; + + NSString* userId = @"test-user-id"; + NSString* deviceId = @"test-device-id"; + AMPEventOptions* eventOptions = [AMPEventOptions new]; + eventOptions.deviceId = deviceId; + eventOptions.userId = userId; + + [_ampli.client add:[AMPPlugin initWithType:AMPPluginTypeBefore execute:^AMPBaseEvent* _Nullable(AMPBaseEvent* _Nonnull event) { + XCTAssertEqualObjects(event.eventType, @"$identify"); + XCTAssertEqualObjects(event.userId, userId); + XCTAssertEqualObjects(event.deviceId, deviceId); + [self->_pluginRun fulfill]; + return event; + }]]; + + [_ampli identify:userId + event:[Identify requiredNumber: 22.0F builderBlock:^(IdentifyBuilder *b) { + b.optionalArray = [NSArray arrayWithObjects:@"optional string", nil]; + }] + options:eventOptions + ]; + [_ampli flush]; + [self waitForExpectationsWithTimeout:2.0 handler:^(NSError *error) { + if (error) { + NSLog(@"timeout errored: %@", error); + XCTFail(@"test timed out"); + } + }]; +} + +- (void)testIdentifyUserIdOnEvent { + [self initAmpliWithNewInstance:@"testIdentifyUserIdOnEvent"]; + + NSString *eventOptionsUserId = @"test-user-id-options"; + NSString *deviceId = @"test-device-id"; + AMPEventOptions* eventOptions = [AMPEventOptions new]; + eventOptions.deviceId = deviceId; + eventOptions.userId = eventOptionsUserId; + + [_ampli.client add:[AMPPlugin initWithType:AMPPluginTypeBefore execute:^AMPBaseEvent* _Nullable(AMPBaseEvent* _Nonnull event) { + XCTAssertEqualObjects(event.eventType, @"$identify"); + XCTAssertEqualObjects(event.userId, eventOptionsUserId); + XCTAssertEqualObjects(event.deviceId, deviceId); + XCTAssertEqualObjects([self->_ampli.client getUserId], eventOptionsUserId); + [self->_pluginRun fulfill]; + return event; + }]]; + + [_ampli identify:nil + event:[Identify requiredNumber: 22.0F builderBlock:^(IdentifyBuilder *b) { + b.optionalArray = [NSArray arrayWithObjects:@"optional string", nil]; + }] + options:eventOptions + ]; + [_ampli flush]; + + [self waitForExpectationsWithTimeout:2.0 handler:^(NSError *error) { + if (error) { + NSLog(@"timeout errored: %@", error); + XCTFail(@"test timed out"); + } + }]; +} + +- (void)testSetGroup { + [self initAmpliWithNewInstance:@"testSetGroup"]; + + NSString *groupType = @"test group type"; + NSString *groupName = @"test group name"; + + [_ampli.client add:[AMPPlugin initWithType:AMPPluginTypeBefore execute:^AMPBaseEvent* _Nullable(AMPBaseEvent* _Nonnull event) { + XCTAssertEqualObjects(event.eventType, @"$identify"); + AMPProperties* userProperties = event.userProperties; + NSMutableDictionary *userPropertiesSet = [userProperties get:@"$set"]; + XCTAssertEqualObjects(userPropertiesSet[groupType], groupName); + [self->_pluginRun fulfill]; + return event; + }]]; + + [_ampli.client setGroup:groupType groupName:groupName]; + [_ampli flush]; + + [self waitForExpectationsWithTimeout:2.0 handler:^(NSError *error) { + if (error) { + NSLog(@"timeout errored: %@", error); + XCTFail(@"test timed out"); + } + }]; +} + +- (void)testGroupIdentify { + [self initAmpliWithNewInstance:@"testGroupIdentify"]; + + NSString *groupType = @"test-group-type"; + NSString *groupName = @"test-group"; + + [_ampli.client add:[AMPPlugin initWithType:AMPPluginTypeBefore execute:^AMPBaseEvent* _Nullable(AMPBaseEvent* _Nonnull event) { + XCTAssertEqualObjects(event.eventType, @"$groupidentify"); + AMPProperties* groups = event.groups; + XCTAssertEqual([groups get:groupType], groupName); + NSMutableDictionary* groupPropertiesSet = [event.groupProperties get:@"$set"]; + XCTAssertEqual(groupPropertiesSet[@"requiredBoolean"], @false); + XCTAssertEqual(groupPropertiesSet[@"optionalString"], @"optional string"); + [self->_pluginRun fulfill]; + return event; + }]]; + + AMPIdentify* identify = [AMPIdentify new]; + [identify set:@"requiredBoolean" value:@false]; + [identify set:@"optionalString" value:@"optional string"]; + [_ampli.client groupIdentify:groupType groupName:groupName identify:identify]; + [_ampli flush]; + + [self waitForExpectationsWithTimeout:2.0 handler:^(NSError *error) { + if (error) { + NSLog(@"timeout errored: %@", error); + XCTFail(@"test timed out"); + } + }]; +} + +@end diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/README.md b/ios/objective-c/v2/AmpliObjectiveCSampleApp/README.md new file mode 100644 index 00000000..3282278c --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/README.md @@ -0,0 +1,31 @@ +# Ampli iOS SDK 2.0 (Objective-C) +An example app using the Ampli Objective-C SDK V2. + +# Usage + +### Setup the project +You will need to do the following before running the app. +1. Set up environment variable with your API keys + 1. Go to `Edit Scheme > Run > Arguments > Environment Variables` section + 2. Set your Amplitude API key with name `AMPLITUDE_API_KEY` +2. Open `AmpliObjectiveCSampleApp.xcodeproj` with Xcode + +### Run the app +You can run the app using the events from our sample tracking plan. +This will log events to your Amplitude project. +* Just click on run in Xcode + +### Pull your Ampli SDK +If you want to use your own tracking plan and Ampli SDK +1. `npm i -g @amplitude/ampli` +2. `ampli pull` +3. Update `AppDelegate.m` or `ViewController.m` to use the events from your tracking plan + +# Project structure +* README.md - you are here * +* AmpliObjectiveCSampleApp/ + * [AppDelegate.m](AmpliObjectiveCSampleApp/AppDelegate.m) - Ampli SDK usage in an AppDelegate. + * [ViewController.m](AmpliObjectiveCSampleApp/ViewController.m) - Ampli SDK usage in a ViewController. + * Ampli/ + * [Ampli.h](AmpliObjectiveCSampleApp/Ampli/Ampli.h) - Generated SDK, don't modify by hand. Update with `ampli pull` + * [Ampli.m](AmpliObjectiveCSampleApp/Ampli/Ampli.m) - Generated SDK, don't modify by hand. Update with `ampli pull` diff --git a/ios/objective-c/v2/AmpliObjectiveCSampleApp/ampli.json b/ios/objective-c/v2/AmpliObjectiveCSampleApp/ampli.json new file mode 100644 index 00000000..6e74b116 --- /dev/null +++ b/ios/objective-c/v2/AmpliObjectiveCSampleApp/ampli.json @@ -0,0 +1,14 @@ +{ + "OrgId": "132559", + "WorkspaceId": "77b37977-cb3a-42eb-bce3-09f5f7c3adb7", + "SourceId": "0a9a3175-04c5-49ad-89eb-ccd0d88169f5", + "Path": "./AmpliObjectiveCSampleApp/Ampli", + "Branch": "main", + "Version": "1.0.0", + "Runtime": "ios:obj-c-ampli-v2", + "VersionId": "a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c", + "OmitApiKeys": true, + "Platform": "iOS", + "Language": "Obj-C", + "SDK": "AmplitudeSwift ~> 1.0" +} \ No newline at end of file diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj index a8a8c5e3..cbdc4868 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj @@ -649,7 +649,7 @@ repositoryURL = "https://github.com/amplitude/Amplitude-Swift"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 0.4.14; + minimumVersion = 0.7.1; }; }; /* End XCRemoteSwiftPackageReference section */ diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 94628004..715dabb1 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -5,8 +5,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/amplitude/Amplitude-Swift", "state" : { - "revision" : "8293ca0b09aac19b7c87f51ad0386590a066e71f", - "version" : "0.4.14" + "revision" : "4f9c21758a511f4e59226a6bfbcd025f61adc1a0", + "version" : "0.7.1" + } + }, + { + "identity" : "analytics-connector-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/amplitude/analytics-connector-ios.git", + "state" : { + "revision" : "d2f3ec4b022211a67d5d4509135d84359f7f8b8d", + "version" : "1.0.2" } } ], diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift index 34c5fa30..19716382 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift @@ -18,7 +18,7 @@ class AmpliTests: XCTestCase { ampli.load(LoadOptions(client: LoadClientOptions(configuration: Configuration( apiKey: "test-api-key", instanceName: instanceName, - trackingSessionEvents: false, + defaultTracking: DefaultTrackingOptions.NONE, migrateLegacyData: false )))) }