From 1a552e941d4cea14661e8dfdfeb05c587a79ccef Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Wed, 26 Jul 2023 15:24:23 +0400 Subject: [PATCH 01/21] AMP-63100 Move current Swift example to v1 subfolder --- README.md | 7 +++++-- .../AmpliSwiftSampleApp.xcodeproj/project.pbxproj | 0 .../project.xcworkspace/contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../xcschemes/AmpliSwiftSampleApp (iOS).xcscheme | 0 .../xcschemes/AmpliSwiftSampleAppTests.xcscheme | 0 .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../AmpliSwiftSampleAppTests/AmpliTests.swift | 0 ios/swift/{ => v1}/AmpliSwiftSampleApp/Gemfile | 0 ios/swift/{ => v1}/AmpliSwiftSampleApp/Podfile | 0 ios/swift/{ => v1}/AmpliSwiftSampleApp/README.md | 0 .../{ => v1}/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift | 0 .../AmpliSwiftSampleApp.xcdatamodeld/.xccurrentversion | 0 .../Shared.xcdatamodel/contents | 0 .../Shared/AmpliSwiftSampleAppApp.swift | 0 .../Assets.xcassets/AccentColor.colorset/Contents.json | 0 .../Assets.xcassets/AppIcon.appiconset/Contents.json | 0 .../Shared/Assets.xcassets/Contents.json | 0 .../{ => v1}/AmpliSwiftSampleApp/Shared/ContentView.swift | 0 .../{ => v1}/AmpliSwiftSampleApp/Shared/Persistence.swift | 0 .../{ => v1}/AmpliSwiftSampleApp/Shared/TextView.swift | 0 ios/swift/{ => v1}/AmpliSwiftSampleApp/ampli.json | 0 .../{ => v1}/AmpliSwiftSampleApp/macOS/macOS.entitlements | 0 24 files changed, 5 insertions(+), 2 deletions(-) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleAppTests.xcscheme (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/Gemfile (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/Podfile (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/README.md (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/.xccurrentversion (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/Shared.xcdatamodel/contents (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/Shared/Assets.xcassets/Contents.json (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/Shared/ContentView.swift (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/Shared/Persistence.swift (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/Shared/TextView.swift (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/ampli.json (100%) rename ios/swift/{ => v1}/AmpliSwiftSampleApp/macOS/macOS.entitlements (100%) diff --git a/README.md b/README.md index 9a74b7a5..0aeab8bb 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,13 @@ See subproject README's for details on each platform. #### [node/typescript](node/typescript) #### [nextjs/typescript](node/nextjs/ampli-app) -## iOS -#### [ios/swift](ios/swift/AmpliSwiftSampleApp) +## iOS V1 +#### [ios/swift](ios/swift/v1/AmpliSwiftSampleApp) #### [ios/objective-c](ios/objective-c/AmpliObjectiveCSampleApp) +## iOS V2 +#### [ios/swift](ios/swift/v2/AmpliSwiftSampleApp) + ## Android V1 #### [android/kotlin](android/kotlin/v1/AmpliApp) #### [android/java](android/java/v1/AmpliApp) diff --git a/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj b/ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj rename to ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj diff --git a/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme b/ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme rename to ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme diff --git a/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleAppTests.xcscheme b/ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleAppTests.xcscheme similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleAppTests.xcscheme rename to ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleAppTests.xcscheme diff --git a/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata b/ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata rename to ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata diff --git a/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift b/ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift rename to ios/swift/v1/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift diff --git a/ios/swift/AmpliSwiftSampleApp/Gemfile b/ios/swift/v1/AmpliSwiftSampleApp/Gemfile similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/Gemfile rename to ios/swift/v1/AmpliSwiftSampleApp/Gemfile diff --git a/ios/swift/AmpliSwiftSampleApp/Podfile b/ios/swift/v1/AmpliSwiftSampleApp/Podfile similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/Podfile rename to ios/swift/v1/AmpliSwiftSampleApp/Podfile diff --git a/ios/swift/AmpliSwiftSampleApp/README.md b/ios/swift/v1/AmpliSwiftSampleApp/README.md similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/README.md rename to ios/swift/v1/AmpliSwiftSampleApp/README.md diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift b/ios/swift/v1/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift rename to ios/swift/v1/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/.xccurrentversion b/ios/swift/v1/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/.xccurrentversion similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/.xccurrentversion rename to ios/swift/v1/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/.xccurrentversion diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/Shared.xcdatamodel/contents b/ios/swift/v1/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/Shared.xcdatamodel/contents similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/Shared.xcdatamodel/contents rename to ios/swift/v1/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/Shared.xcdatamodel/contents diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift b/ios/swift/v1/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift rename to ios/swift/v1/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json b/ios/swift/v1/AmpliSwiftSampleApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json rename to ios/swift/v1/AmpliSwiftSampleApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/swift/v1/AmpliSwiftSampleApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json rename to ios/swift/v1/AmpliSwiftSampleApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/Assets.xcassets/Contents.json b/ios/swift/v1/AmpliSwiftSampleApp/Shared/Assets.xcassets/Contents.json similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/Shared/Assets.xcassets/Contents.json rename to ios/swift/v1/AmpliSwiftSampleApp/Shared/Assets.xcassets/Contents.json diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/ContentView.swift b/ios/swift/v1/AmpliSwiftSampleApp/Shared/ContentView.swift similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/Shared/ContentView.swift rename to ios/swift/v1/AmpliSwiftSampleApp/Shared/ContentView.swift diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/Persistence.swift b/ios/swift/v1/AmpliSwiftSampleApp/Shared/Persistence.swift similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/Shared/Persistence.swift rename to ios/swift/v1/AmpliSwiftSampleApp/Shared/Persistence.swift diff --git a/ios/swift/AmpliSwiftSampleApp/Shared/TextView.swift b/ios/swift/v1/AmpliSwiftSampleApp/Shared/TextView.swift similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/Shared/TextView.swift rename to ios/swift/v1/AmpliSwiftSampleApp/Shared/TextView.swift diff --git a/ios/swift/AmpliSwiftSampleApp/ampli.json b/ios/swift/v1/AmpliSwiftSampleApp/ampli.json similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/ampli.json rename to ios/swift/v1/AmpliSwiftSampleApp/ampli.json diff --git a/ios/swift/AmpliSwiftSampleApp/macOS/macOS.entitlements b/ios/swift/v1/AmpliSwiftSampleApp/macOS/macOS.entitlements similarity index 100% rename from ios/swift/AmpliSwiftSampleApp/macOS/macOS.entitlements rename to ios/swift/v1/AmpliSwiftSampleApp/macOS/macOS.entitlements From ee0da0d34e22241d3f064fd9266c8bf30e3f009a Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Thu, 3 Aug 2023 12:50:23 +0400 Subject: [PATCH 02/21] AMP-63100 Swift v2 app --- .../project.pbxproj | 609 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../AmpliSwiftSampleApp.entitlements | 10 + .../AmpliSwiftSampleAppApp.swift | 10 + .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 63 ++ .../Assets.xcassets/Contents.json | 6 + .../AmpliSwiftSampleApp/ContentView.swift | 19 + .../Preview Assets.xcassets/Contents.json | 6 + .../AmpliSwiftSampleAppTests.swift | 28 + .../AmpliSwiftSampleAppUITests.swift | 34 + ...mpliSwiftSampleAppUITestsLaunchTests.swift | 25 + 13 files changed, 836 insertions(+) create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleApp.entitlements create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleAppApp.swift create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/Contents.json create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/ContentView.swift create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliSwiftSampleAppTests.swift create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITests.swift create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITestsLaunchTests.swift diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj new file mode 100644 index 00000000..d18df92c --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj @@ -0,0 +1,609 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + BAD7A96F2A7BA19D000CB7D9 /* AmpliSwiftSampleAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A96E2A7BA19D000CB7D9 /* AmpliSwiftSampleAppApp.swift */; }; + BAD7A9712A7BA19D000CB7D9 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A9702A7BA19D000CB7D9 /* ContentView.swift */; }; + BAD7A9732A7BA19E000CB7D9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BAD7A9722A7BA19E000CB7D9 /* Assets.xcassets */; }; + BAD7A9772A7BA19E000CB7D9 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BAD7A9762A7BA19E000CB7D9 /* Preview Assets.xcassets */; }; + BAD7A9812A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A9802A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.swift */; }; + BAD7A98B2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A98A2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift */; }; + BAD7A98D2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A98C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + BAD7A97D2A7BA19E000CB7D9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BAD7A9632A7BA19D000CB7D9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = BAD7A96A2A7BA19D000CB7D9; + remoteInfo = AmpliSwiftSampleApp; + }; + BAD7A9872A7BA19E000CB7D9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BAD7A9632A7BA19D000CB7D9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = BAD7A96A2A7BA19D000CB7D9; + remoteInfo = AmpliSwiftSampleApp; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + BAD7A96B2A7BA19D000CB7D9 /* AmpliSwiftSampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AmpliSwiftSampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BAD7A96E2A7BA19D000CB7D9 /* AmpliSwiftSampleAppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliSwiftSampleAppApp.swift; sourceTree = ""; }; + BAD7A9702A7BA19D000CB7D9 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + BAD7A9722A7BA19E000CB7D9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + BAD7A9742A7BA19E000CB7D9 /* AmpliSwiftSampleApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = AmpliSwiftSampleApp.entitlements; sourceTree = ""; }; + BAD7A9762A7BA19E000CB7D9 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + BAD7A97C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AmpliSwiftSampleAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + BAD7A9802A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliSwiftSampleAppTests.swift; sourceTree = ""; }; + BAD7A9862A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AmpliSwiftSampleAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + BAD7A98A2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliSwiftSampleAppUITests.swift; sourceTree = ""; }; + BAD7A98C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliSwiftSampleAppUITestsLaunchTests.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + BAD7A9682A7BA19D000CB7D9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BAD7A9792A7BA19E000CB7D9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BAD7A9832A7BA19E000CB7D9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + BAD7A9622A7BA19D000CB7D9 = { + isa = PBXGroup; + children = ( + BAD7A96D2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */, + BAD7A97F2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests */, + BAD7A9892A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests */, + BAD7A96C2A7BA19D000CB7D9 /* Products */, + ); + sourceTree = ""; + }; + BAD7A96C2A7BA19D000CB7D9 /* Products */ = { + isa = PBXGroup; + children = ( + BAD7A96B2A7BA19D000CB7D9 /* AmpliSwiftSampleApp.app */, + BAD7A97C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.xctest */, + BAD7A9862A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + BAD7A96D2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */ = { + isa = PBXGroup; + children = ( + BAD7A96E2A7BA19D000CB7D9 /* AmpliSwiftSampleAppApp.swift */, + BAD7A9702A7BA19D000CB7D9 /* ContentView.swift */, + BAD7A9722A7BA19E000CB7D9 /* Assets.xcassets */, + BAD7A9742A7BA19E000CB7D9 /* AmpliSwiftSampleApp.entitlements */, + BAD7A9752A7BA19E000CB7D9 /* Preview Content */, + ); + path = AmpliSwiftSampleApp; + sourceTree = ""; + }; + BAD7A9752A7BA19E000CB7D9 /* Preview Content */ = { + isa = PBXGroup; + children = ( + BAD7A9762A7BA19E000CB7D9 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + BAD7A97F2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests */ = { + isa = PBXGroup; + children = ( + BAD7A9802A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.swift */, + ); + path = AmpliSwiftSampleAppTests; + sourceTree = ""; + }; + BAD7A9892A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests */ = { + isa = PBXGroup; + children = ( + BAD7A98A2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift */, + BAD7A98C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift */, + ); + path = AmpliSwiftSampleAppUITests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + BAD7A96A2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = BAD7A9902A7BA19E000CB7D9 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleApp" */; + buildPhases = ( + BAD7A9672A7BA19D000CB7D9 /* Sources */, + BAD7A9682A7BA19D000CB7D9 /* Frameworks */, + BAD7A9692A7BA19D000CB7D9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AmpliSwiftSampleApp; + productName = AmpliSwiftSampleApp; + productReference = BAD7A96B2A7BA19D000CB7D9 /* AmpliSwiftSampleApp.app */; + productType = "com.apple.product-type.application"; + }; + BAD7A97B2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = BAD7A9932A7BA19E000CB7D9 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleAppTests" */; + buildPhases = ( + BAD7A9782A7BA19E000CB7D9 /* Sources */, + BAD7A9792A7BA19E000CB7D9 /* Frameworks */, + BAD7A97A2A7BA19E000CB7D9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + BAD7A97E2A7BA19E000CB7D9 /* PBXTargetDependency */, + ); + name = AmpliSwiftSampleAppTests; + productName = AmpliSwiftSampleAppTests; + productReference = BAD7A97C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + BAD7A9852A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = BAD7A9962A7BA19E000CB7D9 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleAppUITests" */; + buildPhases = ( + BAD7A9822A7BA19E000CB7D9 /* Sources */, + BAD7A9832A7BA19E000CB7D9 /* Frameworks */, + BAD7A9842A7BA19E000CB7D9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + BAD7A9882A7BA19E000CB7D9 /* PBXTargetDependency */, + ); + name = AmpliSwiftSampleAppUITests; + productName = AmpliSwiftSampleAppUITests; + productReference = BAD7A9862A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + BAD7A9632A7BA19D000CB7D9 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1420; + LastUpgradeCheck = 1420; + TargetAttributes = { + BAD7A96A2A7BA19D000CB7D9 = { + CreatedOnToolsVersion = 14.2; + }; + BAD7A97B2A7BA19E000CB7D9 = { + CreatedOnToolsVersion = 14.2; + TestTargetID = BAD7A96A2A7BA19D000CB7D9; + }; + BAD7A9852A7BA19E000CB7D9 = { + CreatedOnToolsVersion = 14.2; + TestTargetID = BAD7A96A2A7BA19D000CB7D9; + }; + }; + }; + buildConfigurationList = BAD7A9662A7BA19D000CB7D9 /* Build configuration list for PBXProject "AmpliSwiftSampleApp" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = BAD7A9622A7BA19D000CB7D9; + productRefGroup = BAD7A96C2A7BA19D000CB7D9 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + BAD7A96A2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */, + BAD7A97B2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests */, + BAD7A9852A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + BAD7A9692A7BA19D000CB7D9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BAD7A9772A7BA19E000CB7D9 /* Preview Assets.xcassets in Resources */, + BAD7A9732A7BA19E000CB7D9 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BAD7A97A2A7BA19E000CB7D9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BAD7A9842A7BA19E000CB7D9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + BAD7A9672A7BA19D000CB7D9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BAD7A9712A7BA19D000CB7D9 /* ContentView.swift in Sources */, + BAD7A96F2A7BA19D000CB7D9 /* AmpliSwiftSampleAppApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BAD7A9782A7BA19E000CB7D9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BAD7A9812A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BAD7A9822A7BA19E000CB7D9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BAD7A98D2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift in Sources */, + BAD7A98B2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + BAD7A97E2A7BA19E000CB7D9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = BAD7A96A2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */; + targetProxy = BAD7A97D2A7BA19E000CB7D9 /* PBXContainerItemProxy */; + }; + BAD7A9882A7BA19E000CB7D9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = BAD7A96A2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */; + targetProxy = BAD7A9872A7BA19E000CB7D9 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + BAD7A98E2A7BA19E000CB7D9 /* 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++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + 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; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + BAD7A98F2A7BA19E000CB7D9 /* 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++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + 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; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + BAD7A9912A7BA19E000CB7D9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = AmpliSwiftSampleApp/AmpliSwiftSampleApp.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"AmpliSwiftSampleApp/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; + LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 12.6; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + BAD7A9922A7BA19E000CB7D9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = AmpliSwiftSampleApp/AmpliSwiftSampleApp.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"AmpliSwiftSampleApp/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; + LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 12.6; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + BAD7A9942A7BA19E000CB7D9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; + MACOSX_DEPLOYMENT_TARGET = 12.6; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleAppTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AmpliSwiftSampleApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/AmpliSwiftSampleApp"; + }; + name = Debug; + }; + BAD7A9952A7BA19E000CB7D9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; + MACOSX_DEPLOYMENT_TARGET = 12.6; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleAppTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AmpliSwiftSampleApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/AmpliSwiftSampleApp"; + }; + name = Release; + }; + BAD7A9972A7BA19E000CB7D9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; + MACOSX_DEPLOYMENT_TARGET = 12.6; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleAppUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = AmpliSwiftSampleApp; + }; + name = Debug; + }; + BAD7A9982A7BA19E000CB7D9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; + MACOSX_DEPLOYMENT_TARGET = 12.6; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleAppUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = AmpliSwiftSampleApp; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + BAD7A9662A7BA19D000CB7D9 /* Build configuration list for PBXProject "AmpliSwiftSampleApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BAD7A98E2A7BA19E000CB7D9 /* Debug */, + BAD7A98F2A7BA19E000CB7D9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BAD7A9902A7BA19E000CB7D9 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BAD7A9912A7BA19E000CB7D9 /* Debug */, + BAD7A9922A7BA19E000CB7D9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BAD7A9932A7BA19E000CB7D9 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleAppTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BAD7A9942A7BA19E000CB7D9 /* Debug */, + BAD7A9952A7BA19E000CB7D9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BAD7A9962A7BA19E000CB7D9 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleAppUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BAD7A9972A7BA19E000CB7D9 /* Debug */, + BAD7A9982A7BA19E000CB7D9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = BAD7A9632A7BA19D000CB7D9 /* Project object */; +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleApp.entitlements b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleApp.entitlements new file mode 100644 index 00000000..f2ef3ae0 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleApp.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleAppApp.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleAppApp.swift new file mode 100644 index 00000000..96c95bcc --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleAppApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct AmpliSwiftSampleAppApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..532cd729 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,63 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/Contents.json b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/ContentView.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/ContentView.swift new file mode 100644 index 00000000..f54deaba --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/ContentView.swift @@ -0,0 +1,19 @@ +import SwiftUI + +struct ContentView: View { + var body: some View { + VStack { + Image(systemName: "globe") + .imageScale(.large) + .foregroundColor(.accentColor) + Text("Hello, world!") + } + .padding() + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Preview Content/Preview Assets.xcassets/Contents.json b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliSwiftSampleAppTests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliSwiftSampleAppTests.swift new file mode 100644 index 00000000..f45f790c --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliSwiftSampleAppTests.swift @@ -0,0 +1,28 @@ +import XCTest + +final class AmpliSwiftSampleAppTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITests.swift new file mode 100644 index 00000000..c17d7cd9 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITests.swift @@ -0,0 +1,34 @@ +import XCTest + +final class AmpliSwiftSampleAppUITests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITestsLaunchTests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITestsLaunchTests.swift new file mode 100644 index 00000000..973c43ed --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITestsLaunchTests.swift @@ -0,0 +1,25 @@ +import XCTest + +final class AmpliSwiftSampleAppUITestsLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + func testLaunch() throws { + let app = XCUIApplication() + app.launch() + + // Insert steps here to perform after app launch but before taking a screenshot, + // such as logging into a test account or navigating somewhere in the app + + let attachment = XCTAttachment(screenshot: app.screenshot()) + attachment.name = "Launch Screen" + attachment.lifetime = .keepAlways + add(attachment) + } +} From d2323b923d4a5b1ea4df9fd04686de81e3595cf0 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Thu, 3 Aug 2023 13:53:34 +0400 Subject: [PATCH 03/21] AMP-63100 Swift v2 app: add Ampli.swift --- .../project.pbxproj | 39 + .../xcshareddata/swiftpm/Package.resolved | 14 + .../AmpliSwiftSampleApp/Ampli/Ampli.swift | 926 ++++++++++++++++++ 3 files changed, 979 insertions(+) create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj index d18df92c..9d351f20 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj @@ -14,6 +14,8 @@ BAD7A9812A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A9802A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.swift */; }; BAD7A98B2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A98A2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift */; }; BAD7A98D2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A98C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift */; }; + BAD7A99B2A7BAF5E000CB7D9 /* Ampli.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A99A2A7BAF5D000CB7D9 /* Ampli.swift */; }; + BAD7A99E2A7BAFDB000CB7D9 /* Amplitude-Swift in Frameworks */ = {isa = PBXBuildFile; productRef = BAD7A99D2A7BAFDB000CB7D9 /* Amplitude-Swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -45,6 +47,7 @@ BAD7A9862A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AmpliSwiftSampleAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; BAD7A98A2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliSwiftSampleAppUITests.swift; sourceTree = ""; }; BAD7A98C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliSwiftSampleAppUITestsLaunchTests.swift; sourceTree = ""; }; + BAD7A99A2A7BAF5D000CB7D9 /* Ampli.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Ampli.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -52,6 +55,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + BAD7A99E2A7BAFDB000CB7D9 /* Amplitude-Swift in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -95,6 +99,7 @@ BAD7A96D2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */ = { isa = PBXGroup; children = ( + BAD7A9992A7BAF48000CB7D9 /* Ampli */, BAD7A96E2A7BA19D000CB7D9 /* AmpliSwiftSampleAppApp.swift */, BAD7A9702A7BA19D000CB7D9 /* ContentView.swift */, BAD7A9722A7BA19E000CB7D9 /* Assets.xcassets */, @@ -129,6 +134,14 @@ path = AmpliSwiftSampleAppUITests; sourceTree = ""; }; + BAD7A9992A7BAF48000CB7D9 /* Ampli */ = { + isa = PBXGroup; + children = ( + BAD7A99A2A7BAF5D000CB7D9 /* Ampli.swift */, + ); + path = Ampli; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -145,6 +158,9 @@ dependencies = ( ); name = AmpliSwiftSampleApp; + packageProductDependencies = ( + BAD7A99D2A7BAFDB000CB7D9 /* Amplitude-Swift */, + ); productName = AmpliSwiftSampleApp; productReference = BAD7A96B2A7BA19D000CB7D9 /* AmpliSwiftSampleApp.app */; productType = "com.apple.product-type.application"; @@ -217,6 +233,9 @@ Base, ); mainGroup = BAD7A9622A7BA19D000CB7D9; + packageReferences = ( + BAD7A99C2A7BAFDB000CB7D9 /* XCRemoteSwiftPackageReference "Amplitude-Swift" */, + ); productRefGroup = BAD7A96C2A7BA19D000CB7D9 /* Products */; projectDirPath = ""; projectRoot = ""; @@ -260,6 +279,7 @@ buildActionMask = 2147483647; files = ( BAD7A9712A7BA19D000CB7D9 /* ContentView.swift in Sources */, + BAD7A99B2A7BAF5E000CB7D9 /* Ampli.swift in Sources */, BAD7A96F2A7BA19D000CB7D9 /* AmpliSwiftSampleAppApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -604,6 +624,25 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + BAD7A99C2A7BAFDB000CB7D9 /* XCRemoteSwiftPackageReference "Amplitude-Swift" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/amplitude/Amplitude-Swift"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 0.4.7; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + BAD7A99D2A7BAFDB000CB7D9 /* Amplitude-Swift */ = { + isa = XCSwiftPackageProductDependency; + package = BAD7A99C2A7BAFDB000CB7D9 /* XCRemoteSwiftPackageReference "Amplitude-Swift" */; + productName = "Amplitude-Swift"; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = BAD7A9632A7BA19D000CB7D9 /* Project object */; } 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 new file mode 100644 index 00000000..ab415285 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "amplitude-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/amplitude/Amplitude-Swift", + "state" : { + "revision" : "07b14d5ee0d1c3fadabd9fea08705a3220f39f84", + "version" : "0.4.7" + } + } + ], + "version" : 2 +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift new file mode 100644 index 00000000..86cb9db1 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift @@ -0,0 +1,926 @@ +/** + * Ampli - A strong typed wrapper for your Analytics + * + * This file is generated by Amplitude. + * To update run 'ampli pull swift-ampli-v2' + * + * Required dependencies: AmplitudeSwift ~> 0.4 + * Tracking Plan Version: 1 + * Build: 1.0.0 + * Runtime: ios:swift-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/swift-ampli-v2) + */ + +import Foundation +import Amplitude_Swift + +public enum AmpliEnvironment: Int { + case prod, dev +} + +let ApiKey: [AmpliEnvironment: String] = [ + .prod: "", + .dev: "" +] + +let AmpliObservePlan = Plan( + branch: "main", + source: "swift-ampli-v2", + version: "1", + versionId: "a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c" +) + +public class Identify : IdentifyEvent { + + private init(_ eventProperties: [String: Any?]?) { + super.init( + eventType: "$identify", + eventProperties: eventProperties + ) + } + + /** + Identify properties. + + - Parameter requiredNumber: Description for identify requiredNumber + - Parameter optionalArray: Description for identify optionalArray + */ + public convenience init( + requiredNumber: Double, + optionalArray: [String]? = nil + ) { + self.init([ + "optionalArray": optionalArray, + "requiredNumber": requiredNumber + ]) + } + + required init(from decoder: Decoder) throws { + fatalError("init(from:) has not been implemented") + } +} + +public class EventNoProperties : BaseEvent { + + private init(_ eventProperties: [String: Any?]?) { + super.init( + eventType: "Event No Properties", + eventProperties: eventProperties + ) + } + + /** + Event w no properties description + + Owner: Test codegen + */ + public convenience init() { + self.init(nil) + } + + required init(from decoder: Decoder) throws { + fatalError("init(from:) has not been implemented") + } +} + +public class EventObjectTypes : BaseEvent { + + private init(_ eventProperties: [String: Any?]?) { + super.init( + eventType: "Event Object Types", + eventProperties: eventProperties + ) + } + + /** + Event with Object and Object Array + + Owner: Test codegen + + - Parameter requiredObject: Property Object Type + - Parameter requiredObjectArray: Property Object Array Type + */ + public convenience init( + requiredObject: Any, + requiredObjectArray: [Any] + ) { + self.init([ + "requiredObject": requiredObject, + "requiredObjectArray": requiredObjectArray + ]) + } + + required init(from decoder: Decoder) throws { + fatalError("init(from:) has not been implemented") + } +} + +public class EventWithAllProperties : BaseEvent { + + public enum RequiredEnum: String { + case enum1 = "Enum1" + case enum2 = "Enum2" + } + + private init(_ eventProperties: [String: Any?]?) { + super.init( + eventType: "Event With All Properties", + eventProperties: eventProperties + ) + } + + /** + Event w all properties description + + Owner: Test codegen + + - Parameter requiredArray: Event 2 Property - Array + - Parameter requiredBoolean: Event 2 Property - Boolean + - Parameter requiredEnum: Event 2 Property - Enum + - Parameter requiredInteger: Event 2 Property - Integer * * Examples: * 5, 4, 3 + - Parameter requiredNumber: Event 2 Property - Number + - Parameter requiredString: Event 2 Property - String + - Parameter optionalString: Event 2 Property - Optional String * * Examples: * Some string, or another + */ + public convenience init( + requiredArray: [String], + requiredBoolean: Bool, + requiredEnum: EventWithAllProperties.RequiredEnum, + requiredInteger: Int, + requiredNumber: Double, + requiredString: String, + optionalString: String? = nil + ) { + self.init([ + "optionalString": optionalString, + "requiredArray": requiredArray, + "requiredBoolean": requiredBoolean, + "requiredConst": "some-const-value", + "requiredEnum": requiredEnum.rawValue, + "requiredInteger": requiredInteger, + "requiredNumber": requiredNumber, + "requiredString": requiredString + ]) + } + + required init(from decoder: Decoder) throws { + fatalError("init(from:) has not been implemented") + } +} + +public class EventWithArrayTypes : BaseEvent { + + private init(_ eventProperties: [String: Any?]?) { + super.init( + eventType: "Event With Array Types", + eventProperties: eventProperties + ) + } + + /** + Description for event with Array Types + + Owner: Test codegen + + - Parameter requiredBooleanArray: description for required boolean array + - Parameter requiredEnumArray: Description for enum array property + - Parameter requiredNumberArray: Description for required number array + - Parameter requiredObjectArray: Description for required object array + - Parameter requiredStringArray: description for required string array + */ + public convenience init( + requiredBooleanArray: [Bool], + requiredEnumArray: [String], + requiredNumberArray: [Double], + requiredObjectArray: [Any], + requiredStringArray: [String] + ) { + self.init([ + "requiredBooleanArray": requiredBooleanArray, + "requiredEnumArray": requiredEnumArray, + "requiredNumberArray": requiredNumberArray, + "requiredObjectArray": requiredObjectArray, + "requiredStringArray": requiredStringArray + ]) + } + + required init(from decoder: Decoder) throws { + fatalError("init(from:) has not been implemented") + } +} + +public class EventWithConstTypes : BaseEvent { + + private init(_ eventProperties: [String: Any?]?) { + super.init( + eventType: "Event With Const Types", + eventProperties: eventProperties + ) + } + + /** + Description for event with const types + + Owner: Test codegen + */ + public convenience init() { + self.init([ + "Boolean Const": true, + "Integer Const": 10, + "Number Const": 2.2, + "String Const": "String-Constant", + "String Const WIth Quotes": "\"String \"Const With\" Quotes\"", + "String Int Const": 0 + ]) + } + + required init(from decoder: Decoder) throws { + fatalError("init(from:) has not been implemented") + } +} + +public class EventWithEnumTypes : BaseEvent { + + public enum OptionalEnum: String { + case optionalEnum1 = "optional enum 1" + case optionalEnum2 = "optional enum 2" + } + + public enum RequiredEnum: String { + case requiredEnum1 = "required enum 1" + case requiredEnum2 = "required enum 2" + } + + private init(_ eventProperties: [String: Any?]?) { + super.init( + eventType: "Event With Enum Types", + eventProperties: eventProperties + ) + } + + /** + Description for event with enum types + + Owner: Test codegen + + - Parameter requiredEnum: Description for optional enum + - Parameter optionalEnum: Description for required enum + */ + public convenience init( + requiredEnum: EventWithEnumTypes.RequiredEnum, + optionalEnum: EventWithEnumTypes.OptionalEnum? = nil + ) { + self.init([ + "optional enum": optionalEnum?.rawValue, + "required enum": requiredEnum.rawValue + ]) + } + + required init(from decoder: Decoder) throws { + fatalError("init(from:) has not been implemented") + } +} + +public class EventWithOptionalArrayTypes : BaseEvent { + + private init(_ eventProperties: [String: Any?]?) { + super.init( + eventType: "Event With Optional Array Types", + eventProperties: eventProperties + ) + } + + /** + Description for event with optional array types + + Owner: Test codegen + + - Parameter optionalBooleanArray: Description for optional boolean array + - Parameter optionalEnumArray: Description for optional enum array + - Parameter optionalJsonArray: Description for optional object array + - Parameter optionalNumberArray: Description for optional number array + - Parameter optionalStringArray: Description for optional string array + */ + public convenience init( + optionalBooleanArray: [Bool]? = nil, + optionalEnumArray: [String]? = nil, + optionalJsonArray: [Any]? = nil, + optionalNumberArray: [Double]? = nil, + optionalStringArray: [String]? = nil + ) { + self.init([ + "optionalBooleanArray": optionalBooleanArray, + "optionalEnumArray": optionalEnumArray, + "optionalJSONArray": optionalJsonArray, + "optionalNumberArray": optionalNumberArray, + "optionalStringArray": optionalStringArray + ]) + } + + required init(from decoder: Decoder) throws { + fatalError("init(from:) has not been implemented") + } +} + +public class EventWithOptionalProperties : BaseEvent { + + private init(_ eventProperties: [String: Any?]?) { + super.init( + eventType: "Event With Optional Properties", + eventProperties: eventProperties + ) + } + + /** + Event w optional properties description + + Owner: Test codegen + + - Parameter optionalArrayNumber: Property has no description provided in tracking plan. + - Parameter optionalArrayString: Property has no description provided in tracking plan. + - Parameter optionalBoolean: Property has no description provided in tracking plan. + - Parameter optionalNumber: Property has no description provided in tracking plan. + - Parameter optionalString: Optional String property description + */ + public convenience init( + optionalArrayNumber: [Double]? = nil, + optionalArrayString: [String]? = nil, + optionalBoolean: Bool? = nil, + optionalNumber: Double? = nil, + optionalString: String? = nil + ) { + self.init([ + "optionalArrayNumber": optionalArrayNumber, + "optionalArrayString": optionalArrayString, + "optionalBoolean": optionalBoolean, + "optionalNumber": optionalNumber, + "optionalString": optionalString + ]) + } + + required init(from decoder: Decoder) throws { + fatalError("init(from:) has not been implemented") + } +} + +public class EventWithTemplateProperties : BaseEvent { + + private init(_ eventProperties: [String: Any?]?) { + super.init( + eventType: "Event With Template Properties", + eventProperties: eventProperties + ) + } + + /** + Event with template properties description + + Owner: Test codegen + + - Parameter requiredEventProperty: required_event_property description + - Parameter requiredTemplateProperty: required_template_property description + - Parameter optionalEventProperty: optional_event_property description + - Parameter optionalTemplateProperty: optional_template_property description + */ + public convenience init( + requiredEventProperty: String, + requiredTemplateProperty: String, + optionalEventProperty: Double? = nil, + optionalTemplateProperty: Double? = nil + ) { + self.init([ + "optional_event_property": optionalEventProperty, + "optional_template_property": optionalTemplateProperty, + "required_event_property": requiredEventProperty, + "required_template_property": requiredTemplateProperty + ]) + } + + required init(from decoder: Decoder) throws { + fatalError("init(from:) has not been implemented") + } +} + +public class EventWithDifferentCasingTypes : BaseEvent { + + public enum EnumWithSpace: String { + case enumWithSpace = "enum with space" + } + + public enum EnumSnakeCase: String { + case enumSnakeCase = "enum_snake_case" + } + + public enum EnumCamelCase: String { + case enumCamelCase = "enumCamelCase" + } + + public enum EnumPascalCase: String { + case enumPascalCase = "EnumPascalCase" + } + + private init(_ eventProperties: [String: Any?]?) { + super.init( + eventType: "event withDifferent_CasingTypes", + eventProperties: eventProperties + ) + } + + /** + Description for case with space + + Owner: Test codegen + + - Parameter enumWithSpace: Description for enum with space + - Parameter enumSnakeCase: description_for_enum_snake_case + - Parameter enumCamelCase: descriptionForEnumCamelCase + - Parameter enumPascalCase: DescirptionForEnumPascalCase + - Parameter propertyWithSpace: Description for case with space + - Parameter propertyWithSnakeCase: Description_for_snake_case + - Parameter propertyWithCamelCase: descriptionForCamelCase + - Parameter propertyWithPascalCase: DescriptionForPascalCase + */ + public convenience init( + enumWithSpace: EventWithDifferentCasingTypes.EnumWithSpace, + enumSnakeCase: EventWithDifferentCasingTypes.EnumSnakeCase, + enumCamelCase: EventWithDifferentCasingTypes.EnumCamelCase, + enumPascalCase: EventWithDifferentCasingTypes.EnumPascalCase, + propertyWithSpace: String, + propertyWithSnakeCase: String, + propertyWithCamelCase: String, + propertyWithPascalCase: String + ) { + self.init([ + "enum with space": enumWithSpace.rawValue, + "enum_snake_case": enumSnakeCase.rawValue, + "enumCamelCase": enumCamelCase.rawValue, + "EnumPascalCase": enumPascalCase.rawValue, + "property with space": propertyWithSpace, + "property_with_snake_case": propertyWithSnakeCase, + "propertyWithCamelCase": propertyWithCamelCase, + "PropertyWithPascalCase": propertyWithPascalCase + ]) + } + + required init(from decoder: Decoder) throws { + fatalError("init(from:) has not been implemented") + } +} + +public class EventMaxIntForTest : BaseEvent { + + private init(_ eventProperties: [String: Any?]?) { + super.init( + eventType: "EventMaxIntForTest", + eventProperties: eventProperties + ) + } + + /** + Event to test schema validation + + Owner: Test codegen + + - Parameter intMax10: property to test schema validation + */ + public convenience init( + intMax10: Int + ) { + self.init([ + "intMax10": intMax10 + ]) + } + + required init(from decoder: Decoder) throws { + fatalError("init(from:) has not been implemented") + } +} + +public struct LoadClientConfig { + public let configuration: Configuration? + + public init(configuration: Configuration? = nil) { + self.configuration = configuration + } +} + +public struct LoadClientOptions { + public let apiKey: String? + public let instance: Amplitude? + public let config: LoadClientConfig? + + public init(apiKey: String? = nil, instance: Amplitude? = nil, config: LoadClientConfig? = nil) { + self.apiKey = apiKey + self.instance = instance + self.config = config + } +} + +public struct LoadOptions { + public let environment: AmpliEnvironment? + public let disabled: Bool? + public let client: LoadClientOptions? + + public init(environment: AmpliEnvironment? = nil, disabled: Bool? = nil, client: LoadClientOptions? = nil) { + self.environment = environment + self.disabled = disabled + self.client = client + } +} + +public class Ampli { + private var amplitude: Amplitude? + public var client: Amplitude { + get { + _ = isInitializedAndEnabled() + return amplitude! + } + } + + public var isLoaded: Bool { + get { + return self.amplitude != nil + } + } + + public private(set) var disabled: Bool + + public init() { + disabled = false + } + + // options should have 'environment', 'client.api_key' or 'client.instance' + public func load(_ options: LoadOptions) -> Void { + self.disabled = options.disabled ?? false + if self.isLoaded { + NSLog("Warning: Ampli is already initialized. Ampli.instance.load() should be called once at application start up.") + return + } + + var apiKey: String? + + if let clientApiKey = options.client?.apiKey { + apiKey = clientApiKey + } else if let environment = options.environment { + apiKey = ApiKey[environment] + } + + if let instance = options.client?.instance { + self.amplitude = instance + } else if let apiKey { + let configuration = options.client?.config?.configuration ?? Configuration(apiKey: apiKey) + if configuration.plan == nil { + configuration.plan = AmpliObservePlan + } + if configuration.ingestionMetadata == nil { + configuration.ingestionMetadata = IngestionMetadata( + sourceName: "ios-swift-ampli-v2", sourceVersion: "1.0.0" + ) + } + self.amplitude = Amplitude(configuration: configuration) + } else { + NSLog("ampli.load() requires 'environment', 'client.apiKey', or 'client.instance'") + return + } + } + + public func track(_ event: BaseEvent, options: EventOptions? = nil) -> Void { + if !isInitializedAndEnabled() { + return + } + self.handleEventOptions(event, options) + amplitude?.track(eventType: event.eventType, eventProperties: event.eventProperties?.compactMapValues { $0 }) + } + + public func identify(_ userId: String?, _ event: Identify, options: EventOptions? = nil) -> Void { + if !isInitializedAndEnabled() { + return + } + self.handleEventOptions(event, options, userId) + + let identify = Amplitude_Swift.Identify() + event.eventProperties?.forEach{ key, value in + identify.set(property: key, value: value) + } + + amplitude?.identify(identify: identify) + } + + public func flush() -> Void { + if !isInitializedAndEnabled() { + return + } + amplitude?.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 + */ + public func eventNoProperties() { + self.track(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 + + - Parameter requiredObject: Property Object Type + - Parameter requiredObjectArray: Property Object Array Type + */ + public func eventObjectTypes( + requiredObject: Any, + requiredObjectArray: [Any] + ) { + self.track(EventObjectTypes( + requiredObject: requiredObject, + requiredObjectArray: requiredObjectArray + )) + } + + /** + 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 + + - Parameter requiredArray: Event 2 Property - Array + - Parameter requiredBoolean: Event 2 Property - Boolean + - Parameter requiredEnum: Event 2 Property - Enum + - Parameter requiredInteger: Event 2 Property - Integer * * Examples: * 5, 4, 3 + - Parameter requiredNumber: Event 2 Property - Number + - Parameter requiredString: Event 2 Property - String + - Parameter optionalString: Event 2 Property - Optional String * * Examples: * Some string, or another + */ + public func eventWithAllProperties( + requiredArray: [String], + requiredBoolean: Bool, + requiredEnum: EventWithAllProperties.RequiredEnum, + requiredInteger: Int, + requiredNumber: Double, + requiredString: String, + optionalString: String? = nil + ) { + self.track(EventWithAllProperties( + requiredArray: requiredArray, + requiredBoolean: requiredBoolean, + requiredEnum: requiredEnum, + requiredInteger: requiredInteger, + requiredNumber: requiredNumber, + requiredString: requiredString, + optionalString: optionalString + )) + } + + /** + 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 + + - Parameter requiredBooleanArray: description for required boolean array + - Parameter requiredEnumArray: Description for enum array property + - Parameter requiredNumberArray: Description for required number array + - Parameter requiredObjectArray: Description for required object array + - Parameter requiredStringArray: description for required string array + */ + public func eventWithArrayTypes( + requiredBooleanArray: [Bool], + requiredEnumArray: [String], + requiredNumberArray: [Double], + requiredObjectArray: [Any], + requiredStringArray: [String] + ) { + self.track(EventWithArrayTypes( + requiredBooleanArray: requiredBooleanArray, + requiredEnumArray: requiredEnumArray, + requiredNumberArray: requiredNumberArray, + requiredObjectArray: requiredObjectArray, + requiredStringArray: requiredStringArray + )) + } + + /** + 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 + */ + public func eventWithConstTypes() { + self.track(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 + + - Parameter requiredEnum: Description for optional enum + - Parameter optionalEnum: Description for required enum + */ + public func eventWithEnumTypes( + requiredEnum: EventWithEnumTypes.RequiredEnum, + optionalEnum: EventWithEnumTypes.OptionalEnum? = nil + ) { + self.track(EventWithEnumTypes( + requiredEnum: requiredEnum, + optionalEnum: optionalEnum + )) + } + + /** + 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 + + - Parameter optionalBooleanArray: Description for optional boolean array + - Parameter optionalEnumArray: Description for optional enum array + - Parameter optionalJsonArray: Description for optional object array + - Parameter optionalNumberArray: Description for optional number array + - Parameter optionalStringArray: Description for optional string array + */ + public func eventWithOptionalArrayTypes( + optionalBooleanArray: [Bool]? = nil, + optionalEnumArray: [String]? = nil, + optionalJsonArray: [Any]? = nil, + optionalNumberArray: [Double]? = nil, + optionalStringArray: [String]? = nil + ) { + self.track(EventWithOptionalArrayTypes( + optionalBooleanArray: optionalBooleanArray, + optionalEnumArray: optionalEnumArray, + optionalJsonArray: optionalJsonArray, + optionalNumberArray: optionalNumberArray, + optionalStringArray: optionalStringArray + )) + } + + /** + 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 + + - Parameter optionalArrayNumber: Property has no description provided in tracking plan. + - Parameter optionalArrayString: Property has no description provided in tracking plan. + - Parameter optionalBoolean: Property has no description provided in tracking plan. + - Parameter optionalNumber: Property has no description provided in tracking plan. + - Parameter optionalString: Optional String property description + */ + public func eventWithOptionalProperties( + optionalArrayNumber: [Double]? = nil, + optionalArrayString: [String]? = nil, + optionalBoolean: Bool? = nil, + optionalNumber: Double? = nil, + optionalString: String? = nil + ) { + self.track(EventWithOptionalProperties( + optionalArrayNumber: optionalArrayNumber, + optionalArrayString: optionalArrayString, + optionalBoolean: optionalBoolean, + optionalNumber: optionalNumber, + optionalString: optionalString + )) + } + + /** + 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 + + - Parameter requiredEventProperty: required_event_property description + - Parameter requiredTemplateProperty: required_template_property description + - Parameter optionalEventProperty: optional_event_property description + - Parameter optionalTemplateProperty: optional_template_property description + */ + public func eventWithTemplateProperties( + requiredEventProperty: String, + requiredTemplateProperty: String, + optionalEventProperty: Double? = nil, + optionalTemplateProperty: Double? = nil + ) { + self.track(EventWithTemplateProperties( + requiredEventProperty: requiredEventProperty, + requiredTemplateProperty: requiredTemplateProperty, + optionalEventProperty: optionalEventProperty, + optionalTemplateProperty: optionalTemplateProperty + )) + } + + /** + 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 + + - Parameter enumWithSpace: Description for enum with space + - Parameter enumSnakeCase: description_for_enum_snake_case + - Parameter enumCamelCase: descriptionForEnumCamelCase + - Parameter enumPascalCase: DescirptionForEnumPascalCase + - Parameter propertyWithSpace: Description for case with space + - Parameter propertyWithSnakeCase: Description_for_snake_case + - Parameter propertyWithCamelCase: descriptionForCamelCase + - Parameter propertyWithPascalCase: DescriptionForPascalCase + */ + public func eventWithDifferentCasingTypes( + enumWithSpace: EventWithDifferentCasingTypes.EnumWithSpace, + enumSnakeCase: EventWithDifferentCasingTypes.EnumSnakeCase, + enumCamelCase: EventWithDifferentCasingTypes.EnumCamelCase, + enumPascalCase: EventWithDifferentCasingTypes.EnumPascalCase, + propertyWithSpace: String, + propertyWithSnakeCase: String, + propertyWithCamelCase: String, + propertyWithPascalCase: String + ) { + self.track(EventWithDifferentCasingTypes( + enumWithSpace: enumWithSpace, + enumSnakeCase: enumSnakeCase, + enumCamelCase: enumCamelCase, + enumPascalCase: enumPascalCase, + propertyWithSpace: propertyWithSpace, + propertyWithSnakeCase: propertyWithSnakeCase, + propertyWithCamelCase: propertyWithCamelCase, + propertyWithPascalCase: propertyWithPascalCase + )) + } + + /** + 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 + + - Parameter intMax10: property to test schema validation + */ + public func eventMaxIntForTest( + intMax10: Int + ) { + self.track(EventMaxIntForTest( + intMax10: intMax10 + )) + } + private func isInitializedAndEnabled() -> Bool { + if !self.isLoaded { + NSLog("Ampli is not yet initialized. Have you called `ampli.load()` on app start?") + return false + } + return !self.disabled + } + + private func handleEventOptions(_ event: BaseEvent, _ options: EventOptions?, _ overrideUserId: String? = nil) { + if let options { + event.mergeEventOptions(eventOptions: options) + } + + if let userId = overrideUserId ?? event.userId { + amplitude?.setUserId(userId: userId) + } + + if let deviceId = event.deviceId { + amplitude?.setDeviceId(deviceId: deviceId) + } + } +} From 73356240359e17f154e206ebd88d5690eebfc8e0 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Fri, 4 Aug 2023 16:57:36 +0400 Subject: [PATCH 04/21] AMP-63100 Swift v2 app: updated Ampli.swift --- .../AmpliSwiftSampleApp/Ampli/Ampli.swift | 253 +++++++++--------- 1 file changed, 126 insertions(+), 127 deletions(-) diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift index 86cb9db1..866e5ab4 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift @@ -33,13 +33,44 @@ let AmpliObservePlan = Plan( versionId: "a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c" ) -public class Identify : IdentifyEvent { +public class Event { + public let eventType: String + public let eventProperties: [String:Any]? + public let options: EventOptions?; - private init(_ eventProperties: [String: Any?]?) { + init(eventType: String, eventProperties: [String:Any?]?, options: EventOptions?) { + self.eventType = eventType; + self.eventProperties = eventProperties?.compactMapValues { $0 }; + self.options = options; + } +} + +public class GenericEvent : Event { + private let eventFactory: (_ eventProperties: [String: Any?]?, _ options: EventOptions?) -> E + + init(eventType: String, eventProperties: [String:Any?]?, options: EventOptions?, eventFactory: @escaping (_ eventProperties: [String: Any?]?, _ options: EventOptions?) -> E) { + self.eventFactory = eventFactory; + super.init(eventType: eventType, eventProperties: eventProperties, options: options) + } + + public func options(_ options: EventOptions) -> E { + return self.eventFactory(self.eventProperties, options); + } + + public func options(deviceId: String? = nil, userId: String? = nil) -> E { + return self.options(EventOptions(userId: userId, deviceId: deviceId)); + } +} + +public class Identify : GenericEvent { + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { super.init( eventType: "$identify", - eventProperties: eventProperties - ) + eventProperties: eventProperties, + options: options, + eventFactory: Identify.init + ); } /** @@ -55,21 +86,19 @@ public class Identify : IdentifyEvent { self.init([ "optionalArray": optionalArray, "requiredNumber": requiredNumber - ]) - } - - required init(from decoder: Decoder) throws { - fatalError("init(from:) has not been implemented") + ]); } } -public class EventNoProperties : BaseEvent { +public class EventNoProperties : GenericEvent { - private init(_ eventProperties: [String: Any?]?) { + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { super.init( eventType: "Event No Properties", - eventProperties: eventProperties - ) + eventProperties: eventProperties, + options: options, + eventFactory: EventNoProperties.init + ); } /** @@ -78,21 +107,19 @@ public class EventNoProperties : BaseEvent { Owner: Test codegen */ public convenience init() { - self.init(nil) - } - - required init(from decoder: Decoder) throws { - fatalError("init(from:) has not been implemented") + self.init(nil); } } -public class EventObjectTypes : BaseEvent { +public class EventObjectTypes : GenericEvent { - private init(_ eventProperties: [String: Any?]?) { + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { super.init( eventType: "Event Object Types", - eventProperties: eventProperties - ) + eventProperties: eventProperties, + options: options, + eventFactory: EventObjectTypes.init + ); } /** @@ -110,26 +137,24 @@ public class EventObjectTypes : BaseEvent { self.init([ "requiredObject": requiredObject, "requiredObjectArray": requiredObjectArray - ]) - } - - required init(from decoder: Decoder) throws { - fatalError("init(from:) has not been implemented") + ]); } } -public class EventWithAllProperties : BaseEvent { +public class EventWithAllProperties : GenericEvent { public enum RequiredEnum: String { case enum1 = "Enum1" case enum2 = "Enum2" } - private init(_ eventProperties: [String: Any?]?) { + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { super.init( eventType: "Event With All Properties", - eventProperties: eventProperties - ) + eventProperties: eventProperties, + options: options, + eventFactory: EventWithAllProperties.init + ); } /** @@ -163,21 +188,19 @@ public class EventWithAllProperties : BaseEvent { "requiredInteger": requiredInteger, "requiredNumber": requiredNumber, "requiredString": requiredString - ]) - } - - required init(from decoder: Decoder) throws { - fatalError("init(from:) has not been implemented") + ]); } } -public class EventWithArrayTypes : BaseEvent { +public class EventWithArrayTypes : GenericEvent { - private init(_ eventProperties: [String: Any?]?) { + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { super.init( eventType: "Event With Array Types", - eventProperties: eventProperties - ) + eventProperties: eventProperties, + options: options, + eventFactory: EventWithArrayTypes.init + ); } /** @@ -204,21 +227,19 @@ public class EventWithArrayTypes : BaseEvent { "requiredNumberArray": requiredNumberArray, "requiredObjectArray": requiredObjectArray, "requiredStringArray": requiredStringArray - ]) - } - - required init(from decoder: Decoder) throws { - fatalError("init(from:) has not been implemented") + ]); } } -public class EventWithConstTypes : BaseEvent { +public class EventWithConstTypes : GenericEvent { - private init(_ eventProperties: [String: Any?]?) { + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { super.init( eventType: "Event With Const Types", - eventProperties: eventProperties - ) + eventProperties: eventProperties, + options: options, + eventFactory: EventWithConstTypes.init + ); } /** @@ -234,15 +255,11 @@ public class EventWithConstTypes : BaseEvent { "String Const": "String-Constant", "String Const WIth Quotes": "\"String \"Const With\" Quotes\"", "String Int Const": 0 - ]) - } - - required init(from decoder: Decoder) throws { - fatalError("init(from:) has not been implemented") + ]); } } -public class EventWithEnumTypes : BaseEvent { +public class EventWithEnumTypes : GenericEvent { public enum OptionalEnum: String { case optionalEnum1 = "optional enum 1" @@ -254,11 +271,13 @@ public class EventWithEnumTypes : BaseEvent { case requiredEnum2 = "required enum 2" } - private init(_ eventProperties: [String: Any?]?) { + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { super.init( eventType: "Event With Enum Types", - eventProperties: eventProperties - ) + eventProperties: eventProperties, + options: options, + eventFactory: EventWithEnumTypes.init + ); } /** @@ -276,21 +295,19 @@ public class EventWithEnumTypes : BaseEvent { self.init([ "optional enum": optionalEnum?.rawValue, "required enum": requiredEnum.rawValue - ]) - } - - required init(from decoder: Decoder) throws { - fatalError("init(from:) has not been implemented") + ]); } } -public class EventWithOptionalArrayTypes : BaseEvent { +public class EventWithOptionalArrayTypes : GenericEvent { - private init(_ eventProperties: [String: Any?]?) { + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { super.init( eventType: "Event With Optional Array Types", - eventProperties: eventProperties - ) + eventProperties: eventProperties, + options: options, + eventFactory: EventWithOptionalArrayTypes.init + ); } /** @@ -317,21 +334,19 @@ public class EventWithOptionalArrayTypes : BaseEvent { "optionalJSONArray": optionalJsonArray, "optionalNumberArray": optionalNumberArray, "optionalStringArray": optionalStringArray - ]) - } - - required init(from decoder: Decoder) throws { - fatalError("init(from:) has not been implemented") + ]); } } -public class EventWithOptionalProperties : BaseEvent { +public class EventWithOptionalProperties : GenericEvent { - private init(_ eventProperties: [String: Any?]?) { + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { super.init( eventType: "Event With Optional Properties", - eventProperties: eventProperties - ) + eventProperties: eventProperties, + options: options, + eventFactory: EventWithOptionalProperties.init + ); } /** @@ -358,21 +373,19 @@ public class EventWithOptionalProperties : BaseEvent { "optionalBoolean": optionalBoolean, "optionalNumber": optionalNumber, "optionalString": optionalString - ]) - } - - required init(from decoder: Decoder) throws { - fatalError("init(from:) has not been implemented") + ]); } } -public class EventWithTemplateProperties : BaseEvent { +public class EventWithTemplateProperties : GenericEvent { - private init(_ eventProperties: [String: Any?]?) { + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { super.init( eventType: "Event With Template Properties", - eventProperties: eventProperties - ) + eventProperties: eventProperties, + options: options, + eventFactory: EventWithTemplateProperties.init + ); } /** @@ -396,15 +409,11 @@ public class EventWithTemplateProperties : BaseEvent { "optional_template_property": optionalTemplateProperty, "required_event_property": requiredEventProperty, "required_template_property": requiredTemplateProperty - ]) - } - - required init(from decoder: Decoder) throws { - fatalError("init(from:) has not been implemented") + ]); } } -public class EventWithDifferentCasingTypes : BaseEvent { +public class EventWithDifferentCasingTypes : GenericEvent { public enum EnumWithSpace: String { case enumWithSpace = "enum with space" @@ -422,11 +431,13 @@ public class EventWithDifferentCasingTypes : BaseEvent { case enumPascalCase = "EnumPascalCase" } - private init(_ eventProperties: [String: Any?]?) { + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { super.init( eventType: "event withDifferent_CasingTypes", - eventProperties: eventProperties - ) + eventProperties: eventProperties, + options: options, + eventFactory: EventWithDifferentCasingTypes.init + ); } /** @@ -462,21 +473,19 @@ public class EventWithDifferentCasingTypes : BaseEvent { "property_with_snake_case": propertyWithSnakeCase, "propertyWithCamelCase": propertyWithCamelCase, "PropertyWithPascalCase": propertyWithPascalCase - ]) - } - - required init(from decoder: Decoder) throws { - fatalError("init(from:) has not been implemented") + ]); } } -public class EventMaxIntForTest : BaseEvent { +public class EventMaxIntForTest : GenericEvent { - private init(_ eventProperties: [String: Any?]?) { + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { super.init( eventType: "EventMaxIntForTest", - eventProperties: eventProperties - ) + eventProperties: eventProperties, + options: options, + eventFactory: EventMaxIntForTest.init + ); } /** @@ -491,11 +500,7 @@ public class EventMaxIntForTest : BaseEvent { ) { self.init([ "intMax10": intMax10 - ]) - } - - required init(from decoder: Decoder) throws { - fatalError("init(from:) has not been implemented") + ]); } } @@ -587,26 +592,20 @@ public class Ampli { } } - public func track(_ event: BaseEvent, options: EventOptions? = nil) -> Void { + public func track(_ event: Event, options: EventOptions? = nil) -> Void { if !isInitializedAndEnabled() { return } - self.handleEventOptions(event, options) - amplitude?.track(eventType: event.eventType, eventProperties: event.eventProperties?.compactMapValues { $0 }) + let eventOptions = getEventOptions(event.options, options) + amplitude?.track(eventType: event.eventType, eventProperties: event.eventProperties, options: eventOptions) } public func identify(_ userId: String?, _ event: Identify, options: EventOptions? = nil) -> Void { if !isInitializedAndEnabled() { return } - self.handleEventOptions(event, options, userId) - - let identify = Amplitude_Swift.Identify() - event.eventProperties?.forEach{ key, value in - identify.set(property: key, value: value) - } - - amplitude?.identify(identify: identify) + let eventOptions = getEventOptions(event.options, options, userId) + amplitude?.identify(userProperties: event.eventProperties, options: eventOptions) } public func flush() -> Void { @@ -910,17 +909,17 @@ public class Ampli { return !self.disabled } - private func handleEventOptions(_ event: BaseEvent, _ options: EventOptions?, _ overrideUserId: String? = nil) { + private func getEventOptions(_ options: EventOptions?, _ overrideOptions: EventOptions?, _ overrideUserId: String? = nil) -> EventOptions { + let dummyEvent = BaseEvent(eventType: "dummy") if let options { - event.mergeEventOptions(eventOptions: options) + dummyEvent.mergeEventOptions(eventOptions: options) } - - if let userId = overrideUserId ?? event.userId { - amplitude?.setUserId(userId: userId) + if let overrideOptions { + dummyEvent.mergeEventOptions(eventOptions: overrideOptions) } - - if let deviceId = event.deviceId { - amplitude?.setDeviceId(deviceId: deviceId) + if let overrideUserId { + dummyEvent.userId = overrideUserId } + return dummyEvent } } From 05be371bf6c6d377fc9f74166da6fdf5fc8dc3b9 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Fri, 4 Aug 2023 21:56:19 +0400 Subject: [PATCH 05/21] AMP-63100 Swift v2 app: updated Ampli.swift --- .../Shared/Ampli/Ampli.swift | 171 +++++++++--------- .../AmpliSwiftSampleApp/Ampli/Ampli.swift | 87 ++++----- ios/swift/v2/AmpliSwiftSampleApp/ampli.json | 15 ++ 3 files changed, 147 insertions(+), 126 deletions(-) create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/ampli.json diff --git a/ios/swift/v1/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift b/ios/swift/v1/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift index 71abcda7..6c966286 100644 --- a/ios/swift/v1/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift +++ b/ios/swift/v1/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift @@ -20,29 +20,29 @@ import Amplitude public typealias MiddlewareExtra = [String: Any] public enum AmpliEnvironment: Int { - case prod, dev; + case prod, dev } let ApiKey: [AmpliEnvironment: String] = [ .prod: "", .dev: "" -]; +] let AmpliObservePlan = AMPPlan() .setBranch("main") .setSource("swift-ampli") .setVersion("1") - .setVersionId("a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c"); + .setVersionId("a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c") public class Event { public let eventType: String public let eventProperties: [String:Any]? - public let options: EventOptions?; + public let options: EventOptions? init(eventType: String, eventProperties: [String:Any?]?, options: EventOptions?) { - self.eventType = eventType; - self.eventProperties = eventProperties?.compactMapValues { $0 }; - self.options = options; + self.eventType = eventType + self.eventProperties = eventProperties?.compactMapValues { $0 } + self.options = options } } @@ -50,16 +50,16 @@ public class GenericEvent : Event { private let eventFactory: (_ eventProperties: [String: Any?]?, _ options: EventOptions?) -> E init(eventType: String, eventProperties: [String:Any?]?, options: EventOptions?, eventFactory: @escaping (_ eventProperties: [String: Any?]?, _ options: EventOptions?) -> E) { - self.eventFactory = eventFactory; + self.eventFactory = eventFactory super.init(eventType: eventType, eventProperties: eventProperties, options: options) } public func options(_ options: EventOptions) -> E { - return self.eventFactory(self.eventProperties, options); + return self.eventFactory(self.eventProperties, options) } public func options(deviceId: String? = nil, userId: String? = nil) -> E { - return self.options(EventOptions(deviceId: deviceId, userId: userId)); + return self.options(EventOptions(deviceId: deviceId, userId: userId)) } } @@ -71,7 +71,7 @@ public class Identify : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: Identify.init - ); + ) } /** @@ -87,7 +87,7 @@ public class Identify : GenericEvent { self.init([ "optionalArray": optionalArray, "requiredNumber": requiredNumber - ]); + ]) } } @@ -99,7 +99,7 @@ public class EventNoProperties : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventNoProperties.init - ); + ) } /** @@ -108,7 +108,7 @@ public class EventNoProperties : GenericEvent { Owner: Test codegen */ public convenience init() { - self.init(nil); + self.init(nil) } } @@ -120,7 +120,7 @@ public class EventObjectTypes : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventObjectTypes.init - ); + ) } /** @@ -138,7 +138,7 @@ public class EventObjectTypes : GenericEvent { self.init([ "requiredObject": requiredObject, "requiredObjectArray": requiredObjectArray - ]); + ]) } } @@ -155,7 +155,7 @@ public class EventWithAllProperties : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventWithAllProperties.init - ); + ) } /** @@ -189,7 +189,7 @@ public class EventWithAllProperties : GenericEvent { "requiredInteger": requiredInteger, "requiredNumber": requiredNumber, "requiredString": requiredString - ]); + ]) } } @@ -201,7 +201,7 @@ public class EventWithArrayTypes : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventWithArrayTypes.init - ); + ) } /** @@ -228,7 +228,7 @@ public class EventWithArrayTypes : GenericEvent { "requiredNumberArray": requiredNumberArray, "requiredObjectArray": requiredObjectArray, "requiredStringArray": requiredStringArray - ]); + ]) } } @@ -240,7 +240,7 @@ public class EventWithConstTypes : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventWithConstTypes.init - ); + ) } /** @@ -256,7 +256,7 @@ public class EventWithConstTypes : GenericEvent { "String Const": "String-Constant", "String Const WIth Quotes": "\"String \"Const With\" Quotes\"", "String Int Const": 0 - ]); + ]) } } @@ -278,7 +278,7 @@ public class EventWithEnumTypes : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventWithEnumTypes.init - ); + ) } /** @@ -296,7 +296,7 @@ public class EventWithEnumTypes : GenericEvent { self.init([ "optional enum": optionalEnum?.rawValue, "required enum": requiredEnum.rawValue - ]); + ]) } } @@ -308,7 +308,7 @@ public class EventWithOptionalArrayTypes : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventMaxIntForTest.init - ); + ) } /** @@ -501,7 +501,7 @@ public class EventMaxIntForTest : GenericEvent { ) { self.init([ "intMax10": intMax10 - ]); + ]) } } @@ -542,86 +542,94 @@ public struct EventOptions { public let userId: String? public init(deviceId: String? = nil, userId: String? = nil) { - self.deviceId = deviceId; - self.userId = userId; + self.deviceId = deviceId + self.userId = userId } } public class Ampli { - private var amplitude: Amplitude?; + private var amplitude: Amplitude? public var client: Amplitude { get { - _ = isInitializedAndEnabled(); - return amplitude!; + _ = isInitializedAndEnabled() + return amplitude! } } public var isLoaded: Bool { get { - return self.amplitude != nil; + return self.amplitude != nil } } - public private(set) var disabled: Bool; + public private(set) var disabled: Bool public static let instance: Ampli = Ampli() public init() { - disabled = false; + disabled = false + } + + private func isInitializedAndEnabled() -> Bool { + if !self.isLoaded { + NSLog("Ampli is not yet initialized. Have you called `ampli.load()` on app start?") + return false + } + return !self.disabled } // options should have 'environment', 'client.api_key' or 'client.instance' public func load(_ options: LoadOptions) -> Void { - self.disabled = options.disabled ?? false; + self.disabled = options.disabled ?? false if (self.isLoaded) { - NSLog("Warning: Ampli is already initialized. Ampli.instance.load() should be called once at application start up."); - return; + NSLog("Warning: Ampli is already initialized. Ampli.instance.load() should be called once at application start up.") + return } - var apiKey: String?; + var apiKey: String? if (options.client?.apiKey != nil) { - apiKey = options.client?.apiKey; + apiKey = options.client?.apiKey } else if (options.environment != nil) { - apiKey = ApiKey[options.environment!]; + apiKey = ApiKey[options.environment!] } if (options.client?.instance != nil) { - self.amplitude = options.client?.instance; + self.amplitude = options.client?.instance } else if (apiKey != nil) { - self.amplitude = Amplitude.instance(); + self.amplitude = Amplitude.instance() self.amplitude?.initializeApiKey(apiKey!); } else { - NSLog("ampli.load() requires 'environment', 'client.apiKey', or 'client.instance'"); - return; + NSLog("ampli.load() requires 'environment', 'client.apiKey', or 'client.instance'") + return } - self.amplitude?.setPlan(options.client?.config?.plan ?? AmpliObservePlan!); + self.amplitude?.setPlan(options.client?.config?.plan ?? AmpliObservePlan!) // set ingestionMetadata information let AmpliExtrasMiddleware = AMPBlockMiddleware { (payload, next) in let ingestionMetadata: NSMutableDictionary = [ "source_name": "ios-swift-ampli", "source_version": "1.0.0" - ]; - payload.event["ingestion_metadata"] = ingestionMetadata; + ] + payload.event["ingestion_metadata"] = ingestionMetadata // Continue to next middleware - next(payload); + next(payload) } - self.amplitude?.addEventMiddleware(AmpliExtrasMiddleware); + self.amplitude?.addEventMiddleware(AmpliExtrasMiddleware) } public func track(_ event: Event, options: EventOptions? = nil, extra: MiddlewareExtra? = nil) -> Void { if (!isInitializedAndEnabled()) { - return; + return } - self.handleEventOptions(event.options, options); - amplitude?.logEvent(event.eventType, withEventProperties: event.eventProperties, withMiddlewareExtra: extra as? NSMutableDictionary); + self.handleEventOptions(event.options, options) + amplitude?.logEvent(event.eventType, withEventProperties: event.eventProperties, withMiddlewareExtra: extra as? NSMutableDictionary) } public func identify(_ userId: String?, _ event: Identify, options: EventOptions? = nil, extra: MiddlewareExtra? = nil) -> Void { if (!isInitializedAndEnabled()) { - return; + return } self.handleEventOptions(event.options, options, userId) @@ -635,9 +643,9 @@ public class Ampli { public func flush() -> Void { if (!isInitializedAndEnabled()) { - return; + return } - amplitude?.uploadEvents(); + amplitude?.uploadEvents() } /** @@ -650,7 +658,7 @@ public class Ampli { Owner: Test codegen */ public func eventNoProperties() { - self.track(EventNoProperties()); + self.track(EventNoProperties()) } /** @@ -672,7 +680,7 @@ public class Ampli { self.track(EventObjectTypes( requiredObject: requiredObject, requiredObjectArray: requiredObjectArray - )); + )) } /** @@ -709,7 +717,7 @@ public class Ampli { requiredNumber: requiredNumber, requiredString: requiredString, optionalString: optionalString - )); + )) } /** @@ -740,7 +748,7 @@ public class Ampli { requiredNumberArray: requiredNumberArray, requiredObjectArray: requiredObjectArray, requiredStringArray: requiredStringArray - )); + )) } /** @@ -753,7 +761,7 @@ public class Ampli { Owner: Test codegen */ public func eventWithConstTypes() { - self.track(EventWithConstTypes()); + self.track(EventWithConstTypes()) } /** @@ -775,7 +783,7 @@ public class Ampli { self.track(EventWithEnumTypes( requiredEnum: requiredEnum, optionalEnum: optionalEnum - )); + )) } /** @@ -806,7 +814,7 @@ public class Ampli { optionalJsonArray: optionalJsonArray, optionalNumberArray: optionalNumberArray, optionalStringArray: optionalStringArray - )); + )) } /** @@ -837,7 +845,7 @@ public class Ampli { optionalBoolean: optionalBoolean, optionalNumber: optionalNumber, optionalString: optionalString - )); + )) } /** @@ -865,7 +873,7 @@ public class Ampli { requiredTemplateProperty: requiredTemplateProperty, optionalEventProperty: optionalEventProperty, optionalTemplateProperty: optionalTemplateProperty - )); + )) } /** @@ -905,7 +913,7 @@ public class Ampli { propertyWithSnakeCase: propertyWithSnakeCase, propertyWithCamelCase: propertyWithCamelCase, propertyWithPascalCase: propertyWithPascalCase - )); + )) } /** @@ -924,25 +932,18 @@ public class Ampli { ) { self.track(EventMaxIntForTest( intMax10: intMax10 - )); - } - private func isInitializedAndEnabled() -> Bool { - if (!self.isLoaded) { - NSLog("Ampli is not yet initialized. Have you called `ampli.load()` on app start?"); - return false; - } - return !self.disabled; + )) } private func handleEventOptions(_ options: EventOptions?, _ overrideOptions: EventOptions?, _ overrideUserId: String? = nil) { - let userId = overrideUserId ?? overrideOptions?.userId ?? options?.userId; + let userId = overrideUserId ?? overrideOptions?.userId ?? options?.userId if (userId != nil) { - amplitude?.setUserId(userId); + amplitude?.setUserId(userId) } - let deviceId = overrideOptions?.deviceId ?? options?.deviceId; + let deviceId = overrideOptions?.deviceId ?? options?.deviceId if (deviceId != nil) { - amplitude?.setDeviceId(deviceId!); + amplitude?.setDeviceId(deviceId!) } } } diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift index 866e5ab4..a3908d22 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift @@ -4,7 +4,7 @@ * This file is generated by Amplitude. * To update run 'ampli pull swift-ampli-v2' * - * Required dependencies: AmplitudeSwift ~> 0.4 + * Required dependencies: Amplitude_Swift ~> 0.4 * Tracking Plan Version: 1 * Build: 1.0.0 * Runtime: ios:swift-ampli-v2 @@ -36,12 +36,12 @@ let AmpliObservePlan = Plan( public class Event { public let eventType: String public let eventProperties: [String:Any]? - public let options: EventOptions?; + public let options: EventOptions? init(eventType: String, eventProperties: [String:Any?]?, options: EventOptions?) { - self.eventType = eventType; - self.eventProperties = eventProperties?.compactMapValues { $0 }; - self.options = options; + self.eventType = eventType + self.eventProperties = eventProperties?.compactMapValues { $0 } + self.options = options } } @@ -49,16 +49,16 @@ public class GenericEvent : Event { private let eventFactory: (_ eventProperties: [String: Any?]?, _ options: EventOptions?) -> E init(eventType: String, eventProperties: [String:Any?]?, options: EventOptions?, eventFactory: @escaping (_ eventProperties: [String: Any?]?, _ options: EventOptions?) -> E) { - self.eventFactory = eventFactory; + self.eventFactory = eventFactory super.init(eventType: eventType, eventProperties: eventProperties, options: options) } public func options(_ options: EventOptions) -> E { - return self.eventFactory(self.eventProperties, options); + return self.eventFactory(self.eventProperties, options) } public func options(deviceId: String? = nil, userId: String? = nil) -> E { - return self.options(EventOptions(userId: userId, deviceId: deviceId)); + return self.options(EventOptions(userId: userId, deviceId: deviceId)) } } @@ -70,7 +70,7 @@ public class Identify : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: Identify.init - ); + ) } /** @@ -86,7 +86,7 @@ public class Identify : GenericEvent { self.init([ "optionalArray": optionalArray, "requiredNumber": requiredNumber - ]); + ]) } } @@ -98,7 +98,7 @@ public class EventNoProperties : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventNoProperties.init - ); + ) } /** @@ -107,7 +107,7 @@ public class EventNoProperties : GenericEvent { Owner: Test codegen */ public convenience init() { - self.init(nil); + self.init(nil) } } @@ -119,7 +119,7 @@ public class EventObjectTypes : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventObjectTypes.init - ); + ) } /** @@ -137,7 +137,7 @@ public class EventObjectTypes : GenericEvent { self.init([ "requiredObject": requiredObject, "requiredObjectArray": requiredObjectArray - ]); + ]) } } @@ -154,7 +154,7 @@ public class EventWithAllProperties : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventWithAllProperties.init - ); + ) } /** @@ -188,7 +188,7 @@ public class EventWithAllProperties : GenericEvent { "requiredInteger": requiredInteger, "requiredNumber": requiredNumber, "requiredString": requiredString - ]); + ]) } } @@ -200,7 +200,7 @@ public class EventWithArrayTypes : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventWithArrayTypes.init - ); + ) } /** @@ -227,7 +227,7 @@ public class EventWithArrayTypes : GenericEvent { "requiredNumberArray": requiredNumberArray, "requiredObjectArray": requiredObjectArray, "requiredStringArray": requiredStringArray - ]); + ]) } } @@ -239,7 +239,7 @@ public class EventWithConstTypes : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventWithConstTypes.init - ); + ) } /** @@ -255,7 +255,7 @@ public class EventWithConstTypes : GenericEvent { "String Const": "String-Constant", "String Const WIth Quotes": "\"String \"Const With\" Quotes\"", "String Int Const": 0 - ]); + ]) } } @@ -277,7 +277,7 @@ public class EventWithEnumTypes : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventWithEnumTypes.init - ); + ) } /** @@ -295,7 +295,7 @@ public class EventWithEnumTypes : GenericEvent { self.init([ "optional enum": optionalEnum?.rawValue, "required enum": requiredEnum.rawValue - ]); + ]) } } @@ -307,7 +307,7 @@ public class EventWithOptionalArrayTypes : GenericEvent { eventProperties: eventProperties, options: options, eventFactory: EventMaxIntForTest.init - ); + ) } /** @@ -500,7 +500,7 @@ public class EventMaxIntForTest : GenericEvent { ) { self.init([ "intMax10": intMax10 - ]); + ]) } } @@ -553,10 +553,20 @@ public class Ampli { public private(set) var disabled: Bool + public static let instance: Ampli = Ampli() + public init() { disabled = false } + private func isInitializedAndEnabled() -> Bool { + if !self.isLoaded { + NSLog("Ampli is not yet initialized. Have you called `ampli.load()` on app start?") + return false + } + return !self.disabled + } + // options should have 'environment', 'client.api_key' or 'client.instance' public func load(_ options: LoadOptions) -> Void { self.disabled = options.disabled ?? false @@ -576,7 +586,9 @@ public class Ampli { if let instance = options.client?.instance { self.amplitude = instance } else if let apiKey { - let configuration = options.client?.config?.configuration ?? Configuration(apiKey: apiKey) + let configuration = options.client?.config?.configuration ?? Configuration( + apiKey: apiKey + ) if configuration.plan == nil { configuration.plan = AmpliObservePlan } @@ -600,7 +612,7 @@ public class Ampli { amplitude?.track(eventType: event.eventType, eventProperties: event.eventProperties, options: eventOptions) } - public func identify(_ userId: String?, _ event: Identify, options: EventOptions? = nil) -> Void { + public func identify(_ userId: String?, _ event: Identify, options: EventOptions? = nil, extra: MiddlewareExtra? = nil) -> Void { if !isInitializedAndEnabled() { return } @@ -901,13 +913,6 @@ public class Ampli { intMax10: intMax10 )) } - private func isInitializedAndEnabled() -> Bool { - if !self.isLoaded { - NSLog("Ampli is not yet initialized. Have you called `ampli.load()` on app start?") - return false - } - return !self.disabled - } private func getEventOptions(_ options: EventOptions?, _ overrideOptions: EventOptions?, _ overrideUserId: String? = nil) -> EventOptions { let dummyEvent = BaseEvent(eventType: "dummy") diff --git a/ios/swift/v2/AmpliSwiftSampleApp/ampli.json b/ios/swift/v2/AmpliSwiftSampleApp/ampli.json new file mode 100644 index 00000000..afc7cae5 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/ampli.json @@ -0,0 +1,15 @@ +{ + "Zone": "us", + "OrgId": "132559", + "WorkspaceId": "77b37977-cb3a-42eb-bce3-09f5f7c3adb7", + "SourceId": "ff1de76c-80bb-42ea-8d39-63402f588c7f", + "Runtime": "ios:swift-ampli-v2", + "Platform": "iOS", + "Language": "Swift", + "SDK": "Amplitude_Swift ~> TODO", + "Branch": "main", + "Version": "1.0.0", + "VersionId": "a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c", + "Path": "./AmpliSwiftSampleApp/Ampli", + "OmitApiKeys": true +} \ No newline at end of file From d9f9d7d54dc1fcae0d9c24f4ba7d334a3ba7bd55 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Mon, 7 Aug 2023 09:35:29 +0400 Subject: [PATCH 06/21] AMP-63100 Swift v2 app: updated Ampli.swift --- .../v1/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift | 2 +- .../AmpliSwiftSampleApp/Ampli/Ampli.swift | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ios/swift/v1/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift b/ios/swift/v1/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift index 6c966286..221f005c 100644 --- a/ios/swift/v1/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift +++ b/ios/swift/v1/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift @@ -598,7 +598,7 @@ public class Ampli { self.amplitude = options.client?.instance } else if (apiKey != nil) { self.amplitude = Amplitude.instance() - self.amplitude?.initializeApiKey(apiKey!); + self.amplitude?.initializeApiKey(apiKey!) } else { NSLog("ampli.load() requires 'environment', 'client.apiKey', or 'client.instance'") return diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift index a3908d22..b9a5ea88 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift @@ -585,7 +585,7 @@ public class Ampli { if let instance = options.client?.instance { self.amplitude = instance - } else if let apiKey { + } else if let apiKey = apiKey { let configuration = options.client?.config?.configuration ?? Configuration( apiKey: apiKey ) @@ -612,7 +612,7 @@ public class Ampli { amplitude?.track(eventType: event.eventType, eventProperties: event.eventProperties, options: eventOptions) } - public func identify(_ userId: String?, _ event: Identify, options: EventOptions? = nil, extra: MiddlewareExtra? = nil) -> Void { + public func identify(_ userId: String?, _ event: Identify, options: EventOptions? = nil) -> Void { if !isInitializedAndEnabled() { return } @@ -916,13 +916,13 @@ public class Ampli { private func getEventOptions(_ options: EventOptions?, _ overrideOptions: EventOptions?, _ overrideUserId: String? = nil) -> EventOptions { let dummyEvent = BaseEvent(eventType: "dummy") - if let options { + if let options = options { dummyEvent.mergeEventOptions(eventOptions: options) } - if let overrideOptions { + if let overrideOptions = overrideOptions { dummyEvent.mergeEventOptions(eventOptions: overrideOptions) } - if let overrideUserId { + if let overrideUserId = overrideUserId { dummyEvent.userId = overrideUserId } return dummyEvent From c39bdc63c953e6f559d144ca7fe9a1677210752a Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Tue, 8 Aug 2023 16:24:37 +0400 Subject: [PATCH 07/21] AMP-63100 Swift v2 app: updated Ampli.swift --- .../AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift | 4 ++-- ios/swift/v2/AmpliSwiftSampleApp/ampli.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift index b9a5ea88..170379f4 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift @@ -4,7 +4,7 @@ * This file is generated by Amplitude. * To update run 'ampli pull swift-ampli-v2' * - * Required dependencies: Amplitude_Swift ~> 0.4 + * Required dependencies: https://github.com/amplitude/Amplitude-Swift ~> 1.0 * Tracking Plan Version: 1 * Build: 1.0.0 * Runtime: ios:swift-ampli-v2 @@ -15,7 +15,7 @@ */ import Foundation -import Amplitude_Swift +import AmplitudeSwift public enum AmpliEnvironment: Int { case prod, dev diff --git a/ios/swift/v2/AmpliSwiftSampleApp/ampli.json b/ios/swift/v2/AmpliSwiftSampleApp/ampli.json index afc7cae5..36ddbac0 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/ampli.json +++ b/ios/swift/v2/AmpliSwiftSampleApp/ampli.json @@ -6,7 +6,7 @@ "Runtime": "ios:swift-ampli-v2", "Platform": "iOS", "Language": "Swift", - "SDK": "Amplitude_Swift ~> TODO", + "SDK": "Amplitude-Swift ~> 1.0", "Branch": "main", "Version": "1.0.0", "VersionId": "a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c", From 123729cf365cdd9862f6d6695b7552e97647c535 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Wed, 9 Aug 2023 20:39:18 +0400 Subject: [PATCH 08/21] AMP-63100 Swift v2 app: remove --- .../project.pbxproj | 648 ------------ .../contents.xcworkspacedata | 7 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../xcshareddata/swiftpm/Package.resolved | 14 - .../AmpliSwiftSampleApp/Ampli/Ampli.swift | 930 ------------------ .../AmpliSwiftSampleApp.entitlements | 10 - .../AmpliSwiftSampleAppApp.swift | 10 - .../AccentColor.colorset/Contents.json | 11 - .../AppIcon.appiconset/Contents.json | 63 -- .../Assets.xcassets/Contents.json | 6 - .../AmpliSwiftSampleApp/ContentView.swift | 19 - .../Preview Assets.xcassets/Contents.json | 6 - .../AmpliSwiftSampleAppTests.swift | 28 - .../AmpliSwiftSampleAppUITests.swift | 34 - ...mpliSwiftSampleAppUITestsLaunchTests.swift | 25 - ios/swift/v2/AmpliSwiftSampleApp/ampli.json | 15 - 16 files changed, 1834 deletions(-) delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleApp.entitlements delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleAppApp.swift delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/Contents.json delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/ContentView.swift delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Preview Content/Preview Assets.xcassets/Contents.json delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliSwiftSampleAppTests.swift delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITests.swift delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITestsLaunchTests.swift delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/ampli.json diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj deleted file mode 100644 index 9d351f20..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj +++ /dev/null @@ -1,648 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 56; - objects = { - -/* Begin PBXBuildFile section */ - BAD7A96F2A7BA19D000CB7D9 /* AmpliSwiftSampleAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A96E2A7BA19D000CB7D9 /* AmpliSwiftSampleAppApp.swift */; }; - BAD7A9712A7BA19D000CB7D9 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A9702A7BA19D000CB7D9 /* ContentView.swift */; }; - BAD7A9732A7BA19E000CB7D9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BAD7A9722A7BA19E000CB7D9 /* Assets.xcassets */; }; - BAD7A9772A7BA19E000CB7D9 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BAD7A9762A7BA19E000CB7D9 /* Preview Assets.xcassets */; }; - BAD7A9812A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A9802A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.swift */; }; - BAD7A98B2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A98A2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift */; }; - BAD7A98D2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A98C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift */; }; - BAD7A99B2A7BAF5E000CB7D9 /* Ampli.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD7A99A2A7BAF5D000CB7D9 /* Ampli.swift */; }; - BAD7A99E2A7BAFDB000CB7D9 /* Amplitude-Swift in Frameworks */ = {isa = PBXBuildFile; productRef = BAD7A99D2A7BAFDB000CB7D9 /* Amplitude-Swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - BAD7A97D2A7BA19E000CB7D9 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BAD7A9632A7BA19D000CB7D9 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BAD7A96A2A7BA19D000CB7D9; - remoteInfo = AmpliSwiftSampleApp; - }; - BAD7A9872A7BA19E000CB7D9 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BAD7A9632A7BA19D000CB7D9 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BAD7A96A2A7BA19D000CB7D9; - remoteInfo = AmpliSwiftSampleApp; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - BAD7A96B2A7BA19D000CB7D9 /* AmpliSwiftSampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AmpliSwiftSampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; - BAD7A96E2A7BA19D000CB7D9 /* AmpliSwiftSampleAppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliSwiftSampleAppApp.swift; sourceTree = ""; }; - BAD7A9702A7BA19D000CB7D9 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; - BAD7A9722A7BA19E000CB7D9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - BAD7A9742A7BA19E000CB7D9 /* AmpliSwiftSampleApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = AmpliSwiftSampleApp.entitlements; sourceTree = ""; }; - BAD7A9762A7BA19E000CB7D9 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; - BAD7A97C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AmpliSwiftSampleAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - BAD7A9802A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliSwiftSampleAppTests.swift; sourceTree = ""; }; - BAD7A9862A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AmpliSwiftSampleAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - BAD7A98A2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliSwiftSampleAppUITests.swift; sourceTree = ""; }; - BAD7A98C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliSwiftSampleAppUITestsLaunchTests.swift; sourceTree = ""; }; - BAD7A99A2A7BAF5D000CB7D9 /* Ampli.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Ampli.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - BAD7A9682A7BA19D000CB7D9 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - BAD7A99E2A7BAFDB000CB7D9 /* Amplitude-Swift in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BAD7A9792A7BA19E000CB7D9 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BAD7A9832A7BA19E000CB7D9 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - BAD7A9622A7BA19D000CB7D9 = { - isa = PBXGroup; - children = ( - BAD7A96D2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */, - BAD7A97F2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests */, - BAD7A9892A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests */, - BAD7A96C2A7BA19D000CB7D9 /* Products */, - ); - sourceTree = ""; - }; - BAD7A96C2A7BA19D000CB7D9 /* Products */ = { - isa = PBXGroup; - children = ( - BAD7A96B2A7BA19D000CB7D9 /* AmpliSwiftSampleApp.app */, - BAD7A97C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.xctest */, - BAD7A9862A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - BAD7A96D2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */ = { - isa = PBXGroup; - children = ( - BAD7A9992A7BAF48000CB7D9 /* Ampli */, - BAD7A96E2A7BA19D000CB7D9 /* AmpliSwiftSampleAppApp.swift */, - BAD7A9702A7BA19D000CB7D9 /* ContentView.swift */, - BAD7A9722A7BA19E000CB7D9 /* Assets.xcassets */, - BAD7A9742A7BA19E000CB7D9 /* AmpliSwiftSampleApp.entitlements */, - BAD7A9752A7BA19E000CB7D9 /* Preview Content */, - ); - path = AmpliSwiftSampleApp; - sourceTree = ""; - }; - BAD7A9752A7BA19E000CB7D9 /* Preview Content */ = { - isa = PBXGroup; - children = ( - BAD7A9762A7BA19E000CB7D9 /* Preview Assets.xcassets */, - ); - path = "Preview Content"; - sourceTree = ""; - }; - BAD7A97F2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests */ = { - isa = PBXGroup; - children = ( - BAD7A9802A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.swift */, - ); - path = AmpliSwiftSampleAppTests; - sourceTree = ""; - }; - BAD7A9892A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests */ = { - isa = PBXGroup; - children = ( - BAD7A98A2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift */, - BAD7A98C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift */, - ); - path = AmpliSwiftSampleAppUITests; - sourceTree = ""; - }; - BAD7A9992A7BAF48000CB7D9 /* Ampli */ = { - isa = PBXGroup; - children = ( - BAD7A99A2A7BAF5D000CB7D9 /* Ampli.swift */, - ); - path = Ampli; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - BAD7A96A2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */ = { - isa = PBXNativeTarget; - buildConfigurationList = BAD7A9902A7BA19E000CB7D9 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleApp" */; - buildPhases = ( - BAD7A9672A7BA19D000CB7D9 /* Sources */, - BAD7A9682A7BA19D000CB7D9 /* Frameworks */, - BAD7A9692A7BA19D000CB7D9 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = AmpliSwiftSampleApp; - packageProductDependencies = ( - BAD7A99D2A7BAFDB000CB7D9 /* Amplitude-Swift */, - ); - productName = AmpliSwiftSampleApp; - productReference = BAD7A96B2A7BA19D000CB7D9 /* AmpliSwiftSampleApp.app */; - productType = "com.apple.product-type.application"; - }; - BAD7A97B2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = BAD7A9932A7BA19E000CB7D9 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleAppTests" */; - buildPhases = ( - BAD7A9782A7BA19E000CB7D9 /* Sources */, - BAD7A9792A7BA19E000CB7D9 /* Frameworks */, - BAD7A97A2A7BA19E000CB7D9 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - BAD7A97E2A7BA19E000CB7D9 /* PBXTargetDependency */, - ); - name = AmpliSwiftSampleAppTests; - productName = AmpliSwiftSampleAppTests; - productReference = BAD7A97C2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - BAD7A9852A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests */ = { - isa = PBXNativeTarget; - buildConfigurationList = BAD7A9962A7BA19E000CB7D9 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleAppUITests" */; - buildPhases = ( - BAD7A9822A7BA19E000CB7D9 /* Sources */, - BAD7A9832A7BA19E000CB7D9 /* Frameworks */, - BAD7A9842A7BA19E000CB7D9 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - BAD7A9882A7BA19E000CB7D9 /* PBXTargetDependency */, - ); - name = AmpliSwiftSampleAppUITests; - productName = AmpliSwiftSampleAppUITests; - productReference = BAD7A9862A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - BAD7A9632A7BA19D000CB7D9 /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1420; - LastUpgradeCheck = 1420; - TargetAttributes = { - BAD7A96A2A7BA19D000CB7D9 = { - CreatedOnToolsVersion = 14.2; - }; - BAD7A97B2A7BA19E000CB7D9 = { - CreatedOnToolsVersion = 14.2; - TestTargetID = BAD7A96A2A7BA19D000CB7D9; - }; - BAD7A9852A7BA19E000CB7D9 = { - CreatedOnToolsVersion = 14.2; - TestTargetID = BAD7A96A2A7BA19D000CB7D9; - }; - }; - }; - buildConfigurationList = BAD7A9662A7BA19D000CB7D9 /* Build configuration list for PBXProject "AmpliSwiftSampleApp" */; - compatibilityVersion = "Xcode 14.0"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = BAD7A9622A7BA19D000CB7D9; - packageReferences = ( - BAD7A99C2A7BAFDB000CB7D9 /* XCRemoteSwiftPackageReference "Amplitude-Swift" */, - ); - productRefGroup = BAD7A96C2A7BA19D000CB7D9 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - BAD7A96A2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */, - BAD7A97B2A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests */, - BAD7A9852A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - BAD7A9692A7BA19D000CB7D9 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BAD7A9772A7BA19E000CB7D9 /* Preview Assets.xcassets in Resources */, - BAD7A9732A7BA19E000CB7D9 /* Assets.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BAD7A97A2A7BA19E000CB7D9 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BAD7A9842A7BA19E000CB7D9 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - BAD7A9672A7BA19D000CB7D9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BAD7A9712A7BA19D000CB7D9 /* ContentView.swift in Sources */, - BAD7A99B2A7BAF5E000CB7D9 /* Ampli.swift in Sources */, - BAD7A96F2A7BA19D000CB7D9 /* AmpliSwiftSampleAppApp.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BAD7A9782A7BA19E000CB7D9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BAD7A9812A7BA19E000CB7D9 /* AmpliSwiftSampleAppTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BAD7A9822A7BA19E000CB7D9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BAD7A98D2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITestsLaunchTests.swift in Sources */, - BAD7A98B2A7BA19E000CB7D9 /* AmpliSwiftSampleAppUITests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - BAD7A97E2A7BA19E000CB7D9 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BAD7A96A2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */; - targetProxy = BAD7A97D2A7BA19E000CB7D9 /* PBXContainerItemProxy */; - }; - BAD7A9882A7BA19E000CB7D9 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BAD7A96A2A7BA19D000CB7D9 /* AmpliSwiftSampleApp */; - targetProxy = BAD7A9872A7BA19E000CB7D9 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - BAD7A98E2A7BA19E000CB7D9 /* 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++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - 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; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - BAD7A98F2A7BA19E000CB7D9 /* 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++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - 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; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - }; - name = Release; - }; - BAD7A9912A7BA19E000CB7D9 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_ENTITLEMENTS = AmpliSwiftSampleApp/AmpliSwiftSampleApp.entitlements; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = "\"AmpliSwiftSampleApp/Preview Content\""; - ENABLE_PREVIEWS = YES; - GENERATE_INFOPLIST_FILE = YES; - "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; - "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; - "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; - "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; - "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; - "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; - "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; - "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 16.2; - LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; - "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 12.6; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleApp; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = auto; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - BAD7A9922A7BA19E000CB7D9 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_ENTITLEMENTS = AmpliSwiftSampleApp/AmpliSwiftSampleApp.entitlements; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = "\"AmpliSwiftSampleApp/Preview Content\""; - ENABLE_PREVIEWS = YES; - GENERATE_INFOPLIST_FILE = YES; - "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; - "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; - "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; - "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; - "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; - "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; - "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; - "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 16.2; - LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; - "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 12.6; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleApp; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = auto; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - BAD7A9942A7BA19E000CB7D9 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 16.2; - MACOSX_DEPLOYMENT_TARGET = 12.6; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleAppTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = auto; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AmpliSwiftSampleApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/AmpliSwiftSampleApp"; - }; - name = Debug; - }; - BAD7A9952A7BA19E000CB7D9 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 16.2; - MACOSX_DEPLOYMENT_TARGET = 12.6; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleAppTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = auto; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AmpliSwiftSampleApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/AmpliSwiftSampleApp"; - }; - name = Release; - }; - BAD7A9972A7BA19E000CB7D9 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 16.2; - MACOSX_DEPLOYMENT_TARGET = 12.6; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleAppUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = auto; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = AmpliSwiftSampleApp; - }; - name = Debug; - }; - BAD7A9982A7BA19E000CB7D9 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 16.2; - MACOSX_DEPLOYMENT_TARGET = 12.6; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleAppUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = auto; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = AmpliSwiftSampleApp; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - BAD7A9662A7BA19D000CB7D9 /* Build configuration list for PBXProject "AmpliSwiftSampleApp" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BAD7A98E2A7BA19E000CB7D9 /* Debug */, - BAD7A98F2A7BA19E000CB7D9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - BAD7A9902A7BA19E000CB7D9 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleApp" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BAD7A9912A7BA19E000CB7D9 /* Debug */, - BAD7A9922A7BA19E000CB7D9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - BAD7A9932A7BA19E000CB7D9 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleAppTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BAD7A9942A7BA19E000CB7D9 /* Debug */, - BAD7A9952A7BA19E000CB7D9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - BAD7A9962A7BA19E000CB7D9 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleAppUITests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BAD7A9972A7BA19E000CB7D9 /* Debug */, - BAD7A9982A7BA19E000CB7D9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - -/* Begin XCRemoteSwiftPackageReference section */ - BAD7A99C2A7BAFDB000CB7D9 /* XCRemoteSwiftPackageReference "Amplitude-Swift" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/amplitude/Amplitude-Swift"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 0.4.7; - }; - }; -/* End XCRemoteSwiftPackageReference section */ - -/* Begin XCSwiftPackageProductDependency section */ - BAD7A99D2A7BAFDB000CB7D9 /* Amplitude-Swift */ = { - isa = XCSwiftPackageProductDependency; - package = BAD7A99C2A7BAFDB000CB7D9 /* XCRemoteSwiftPackageReference "Amplitude-Swift" */; - productName = "Amplitude-Swift"; - }; -/* End XCSwiftPackageProductDependency section */ - }; - rootObject = BAD7A9632A7BA19D000CB7D9 /* Project object */; -} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a6..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - 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 deleted file mode 100644 index ab415285..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,14 +0,0 @@ -{ - "pins" : [ - { - "identity" : "amplitude-swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/amplitude/Amplitude-Swift", - "state" : { - "revision" : "07b14d5ee0d1c3fadabd9fea08705a3220f39f84", - "version" : "0.4.7" - } - } - ], - "version" : 2 -} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift deleted file mode 100644 index 170379f4..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Ampli/Ampli.swift +++ /dev/null @@ -1,930 +0,0 @@ -/** - * Ampli - A strong typed wrapper for your Analytics - * - * This file is generated by Amplitude. - * To update run 'ampli pull swift-ampli-v2' - * - * Required dependencies: https://github.com/amplitude/Amplitude-Swift ~> 1.0 - * Tracking Plan Version: 1 - * Build: 1.0.0 - * Runtime: ios:swift-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/swift-ampli-v2) - */ - -import Foundation -import AmplitudeSwift - -public enum AmpliEnvironment: Int { - case prod, dev -} - -let ApiKey: [AmpliEnvironment: String] = [ - .prod: "", - .dev: "" -] - -let AmpliObservePlan = Plan( - branch: "main", - source: "swift-ampli-v2", - version: "1", - versionId: "a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c" -) - -public class Event { - public let eventType: String - public let eventProperties: [String:Any]? - public let options: EventOptions? - - init(eventType: String, eventProperties: [String:Any?]?, options: EventOptions?) { - self.eventType = eventType - self.eventProperties = eventProperties?.compactMapValues { $0 } - self.options = options - } -} - -public class GenericEvent : Event { - private let eventFactory: (_ eventProperties: [String: Any?]?, _ options: EventOptions?) -> E - - init(eventType: String, eventProperties: [String:Any?]?, options: EventOptions?, eventFactory: @escaping (_ eventProperties: [String: Any?]?, _ options: EventOptions?) -> E) { - self.eventFactory = eventFactory - super.init(eventType: eventType, eventProperties: eventProperties, options: options) - } - - public func options(_ options: EventOptions) -> E { - return self.eventFactory(self.eventProperties, options) - } - - public func options(deviceId: String? = nil, userId: String? = nil) -> E { - return self.options(EventOptions(userId: userId, deviceId: deviceId)) - } -} - -public class Identify : GenericEvent { - - private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { - super.init( - eventType: "$identify", - eventProperties: eventProperties, - options: options, - eventFactory: Identify.init - ) - } - - /** - Identify properties. - - - Parameter requiredNumber: Description for identify requiredNumber - - Parameter optionalArray: Description for identify optionalArray - */ - public convenience init( - requiredNumber: Double, - optionalArray: [String]? = nil - ) { - self.init([ - "optionalArray": optionalArray, - "requiredNumber": requiredNumber - ]) - } -} - -public class EventNoProperties : GenericEvent { - - private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { - super.init( - eventType: "Event No Properties", - eventProperties: eventProperties, - options: options, - eventFactory: EventNoProperties.init - ) - } - - /** - Event w no properties description - - Owner: Test codegen - */ - public convenience init() { - self.init(nil) - } -} - -public class EventObjectTypes : GenericEvent { - - private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { - super.init( - eventType: "Event Object Types", - eventProperties: eventProperties, - options: options, - eventFactory: EventObjectTypes.init - ) - } - - /** - Event with Object and Object Array - - Owner: Test codegen - - - Parameter requiredObject: Property Object Type - - Parameter requiredObjectArray: Property Object Array Type - */ - public convenience init( - requiredObject: Any, - requiredObjectArray: [Any] - ) { - self.init([ - "requiredObject": requiredObject, - "requiredObjectArray": requiredObjectArray - ]) - } -} - -public class EventWithAllProperties : GenericEvent { - - public enum RequiredEnum: String { - case enum1 = "Enum1" - case enum2 = "Enum2" - } - - private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { - super.init( - eventType: "Event With All Properties", - eventProperties: eventProperties, - options: options, - eventFactory: EventWithAllProperties.init - ) - } - - /** - Event w all properties description - - Owner: Test codegen - - - Parameter requiredArray: Event 2 Property - Array - - Parameter requiredBoolean: Event 2 Property - Boolean - - Parameter requiredEnum: Event 2 Property - Enum - - Parameter requiredInteger: Event 2 Property - Integer * * Examples: * 5, 4, 3 - - Parameter requiredNumber: Event 2 Property - Number - - Parameter requiredString: Event 2 Property - String - - Parameter optionalString: Event 2 Property - Optional String * * Examples: * Some string, or another - */ - public convenience init( - requiredArray: [String], - requiredBoolean: Bool, - requiredEnum: EventWithAllProperties.RequiredEnum, - requiredInteger: Int, - requiredNumber: Double, - requiredString: String, - optionalString: String? = nil - ) { - self.init([ - "optionalString": optionalString, - "requiredArray": requiredArray, - "requiredBoolean": requiredBoolean, - "requiredConst": "some-const-value", - "requiredEnum": requiredEnum.rawValue, - "requiredInteger": requiredInteger, - "requiredNumber": requiredNumber, - "requiredString": requiredString - ]) - } -} - -public class EventWithArrayTypes : GenericEvent { - - private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { - super.init( - eventType: "Event With Array Types", - eventProperties: eventProperties, - options: options, - eventFactory: EventWithArrayTypes.init - ) - } - - /** - Description for event with Array Types - - Owner: Test codegen - - - Parameter requiredBooleanArray: description for required boolean array - - Parameter requiredEnumArray: Description for enum array property - - Parameter requiredNumberArray: Description for required number array - - Parameter requiredObjectArray: Description for required object array - - Parameter requiredStringArray: description for required string array - */ - public convenience init( - requiredBooleanArray: [Bool], - requiredEnumArray: [String], - requiredNumberArray: [Double], - requiredObjectArray: [Any], - requiredStringArray: [String] - ) { - self.init([ - "requiredBooleanArray": requiredBooleanArray, - "requiredEnumArray": requiredEnumArray, - "requiredNumberArray": requiredNumberArray, - "requiredObjectArray": requiredObjectArray, - "requiredStringArray": requiredStringArray - ]) - } -} - -public class EventWithConstTypes : GenericEvent { - - private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { - super.init( - eventType: "Event With Const Types", - eventProperties: eventProperties, - options: options, - eventFactory: EventWithConstTypes.init - ) - } - - /** - Description for event with const types - - Owner: Test codegen - */ - public convenience init() { - self.init([ - "Boolean Const": true, - "Integer Const": 10, - "Number Const": 2.2, - "String Const": "String-Constant", - "String Const WIth Quotes": "\"String \"Const With\" Quotes\"", - "String Int Const": 0 - ]) - } -} - -public class EventWithEnumTypes : GenericEvent { - - public enum OptionalEnum: String { - case optionalEnum1 = "optional enum 1" - case optionalEnum2 = "optional enum 2" - } - - public enum RequiredEnum: String { - case requiredEnum1 = "required enum 1" - case requiredEnum2 = "required enum 2" - } - - private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { - super.init( - eventType: "Event With Enum Types", - eventProperties: eventProperties, - options: options, - eventFactory: EventWithEnumTypes.init - ) - } - - /** - Description for event with enum types - - Owner: Test codegen - - - Parameter requiredEnum: Description for optional enum - - Parameter optionalEnum: Description for required enum - */ - public convenience init( - requiredEnum: EventWithEnumTypes.RequiredEnum, - optionalEnum: EventWithEnumTypes.OptionalEnum? = nil - ) { - self.init([ - "optional enum": optionalEnum?.rawValue, - "required enum": requiredEnum.rawValue - ]) - } -} - -public class EventWithOptionalArrayTypes : GenericEvent { - - private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { - super.init( - eventType: "Event With Optional Array Types", - eventProperties: eventProperties, - options: options, - eventFactory: EventWithOptionalArrayTypes.init - ) - } - - /** - Description for event with optional array types - - Owner: Test codegen - - - Parameter optionalBooleanArray: Description for optional boolean array - - Parameter optionalEnumArray: Description for optional enum array - - Parameter optionalJsonArray: Description for optional object array - - Parameter optionalNumberArray: Description for optional number array - - Parameter optionalStringArray: Description for optional string array - */ - public convenience init( - optionalBooleanArray: [Bool]? = nil, - optionalEnumArray: [String]? = nil, - optionalJsonArray: [Any]? = nil, - optionalNumberArray: [Double]? = nil, - optionalStringArray: [String]? = nil - ) { - self.init([ - "optionalBooleanArray": optionalBooleanArray, - "optionalEnumArray": optionalEnumArray, - "optionalJSONArray": optionalJsonArray, - "optionalNumberArray": optionalNumberArray, - "optionalStringArray": optionalStringArray - ]) - } -} - -public class EventWithOptionalProperties : GenericEvent { - - private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { - super.init( - eventType: "Event With Optional Properties", - eventProperties: eventProperties, - options: options, - eventFactory: EventWithOptionalProperties.init - ) - } - - /** - Event w optional properties description - - Owner: Test codegen - - - Parameter optionalArrayNumber: Property has no description provided in tracking plan. - - Parameter optionalArrayString: Property has no description provided in tracking plan. - - Parameter optionalBoolean: Property has no description provided in tracking plan. - - Parameter optionalNumber: Property has no description provided in tracking plan. - - Parameter optionalString: Optional String property description - */ - public convenience init( - optionalArrayNumber: [Double]? = nil, - optionalArrayString: [String]? = nil, - optionalBoolean: Bool? = nil, - optionalNumber: Double? = nil, - optionalString: String? = nil - ) { - self.init([ - "optionalArrayNumber": optionalArrayNumber, - "optionalArrayString": optionalArrayString, - "optionalBoolean": optionalBoolean, - "optionalNumber": optionalNumber, - "optionalString": optionalString - ]) - } -} - -public class EventWithTemplateProperties : GenericEvent { - - private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { - super.init( - eventType: "Event With Template Properties", - eventProperties: eventProperties, - options: options, - eventFactory: EventWithTemplateProperties.init - ) - } - - /** - Event with template properties description - - Owner: Test codegen - - - Parameter requiredEventProperty: required_event_property description - - Parameter requiredTemplateProperty: required_template_property description - - Parameter optionalEventProperty: optional_event_property description - - Parameter optionalTemplateProperty: optional_template_property description - */ - public convenience init( - requiredEventProperty: String, - requiredTemplateProperty: String, - optionalEventProperty: Double? = nil, - optionalTemplateProperty: Double? = nil - ) { - self.init([ - "optional_event_property": optionalEventProperty, - "optional_template_property": optionalTemplateProperty, - "required_event_property": requiredEventProperty, - "required_template_property": requiredTemplateProperty - ]) - } -} - -public class EventWithDifferentCasingTypes : GenericEvent { - - public enum EnumWithSpace: String { - case enumWithSpace = "enum with space" - } - - public enum EnumSnakeCase: String { - case enumSnakeCase = "enum_snake_case" - } - - public enum EnumCamelCase: String { - case enumCamelCase = "enumCamelCase" - } - - public enum EnumPascalCase: String { - case enumPascalCase = "EnumPascalCase" - } - - private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { - super.init( - eventType: "event withDifferent_CasingTypes", - eventProperties: eventProperties, - options: options, - eventFactory: EventWithDifferentCasingTypes.init - ) - } - - /** - Description for case with space - - Owner: Test codegen - - - Parameter enumWithSpace: Description for enum with space - - Parameter enumSnakeCase: description_for_enum_snake_case - - Parameter enumCamelCase: descriptionForEnumCamelCase - - Parameter enumPascalCase: DescirptionForEnumPascalCase - - Parameter propertyWithSpace: Description for case with space - - Parameter propertyWithSnakeCase: Description_for_snake_case - - Parameter propertyWithCamelCase: descriptionForCamelCase - - Parameter propertyWithPascalCase: DescriptionForPascalCase - */ - public convenience init( - enumWithSpace: EventWithDifferentCasingTypes.EnumWithSpace, - enumSnakeCase: EventWithDifferentCasingTypes.EnumSnakeCase, - enumCamelCase: EventWithDifferentCasingTypes.EnumCamelCase, - enumPascalCase: EventWithDifferentCasingTypes.EnumPascalCase, - propertyWithSpace: String, - propertyWithSnakeCase: String, - propertyWithCamelCase: String, - propertyWithPascalCase: String - ) { - self.init([ - "enum with space": enumWithSpace.rawValue, - "enum_snake_case": enumSnakeCase.rawValue, - "enumCamelCase": enumCamelCase.rawValue, - "EnumPascalCase": enumPascalCase.rawValue, - "property with space": propertyWithSpace, - "property_with_snake_case": propertyWithSnakeCase, - "propertyWithCamelCase": propertyWithCamelCase, - "PropertyWithPascalCase": propertyWithPascalCase - ]) - } -} - -public class EventMaxIntForTest : GenericEvent { - - private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { - super.init( - eventType: "EventMaxIntForTest", - eventProperties: eventProperties, - options: options, - eventFactory: EventMaxIntForTest.init - ) - } - - /** - Event to test schema validation - - Owner: Test codegen - - - Parameter intMax10: property to test schema validation - */ - public convenience init( - intMax10: Int - ) { - self.init([ - "intMax10": intMax10 - ]) - } -} - -public struct LoadClientConfig { - public let configuration: Configuration? - - public init(configuration: Configuration? = nil) { - self.configuration = configuration - } -} - -public struct LoadClientOptions { - public let apiKey: String? - public let instance: Amplitude? - public let config: LoadClientConfig? - - public init(apiKey: String? = nil, instance: Amplitude? = nil, config: LoadClientConfig? = nil) { - self.apiKey = apiKey - self.instance = instance - self.config = config - } -} - -public struct LoadOptions { - public let environment: AmpliEnvironment? - public let disabled: Bool? - public let client: LoadClientOptions? - - public init(environment: AmpliEnvironment? = nil, disabled: Bool? = nil, client: LoadClientOptions? = nil) { - self.environment = environment - self.disabled = disabled - self.client = client - } -} - -public class Ampli { - private var amplitude: Amplitude? - public var client: Amplitude { - get { - _ = isInitializedAndEnabled() - return amplitude! - } - } - - public var isLoaded: Bool { - get { - return self.amplitude != nil - } - } - - public private(set) var disabled: Bool - - public static let instance: Ampli = Ampli() - - public init() { - disabled = false - } - - private func isInitializedAndEnabled() -> Bool { - if !self.isLoaded { - NSLog("Ampli is not yet initialized. Have you called `ampli.load()` on app start?") - return false - } - return !self.disabled - } - - // options should have 'environment', 'client.api_key' or 'client.instance' - public func load(_ options: LoadOptions) -> Void { - self.disabled = options.disabled ?? false - if self.isLoaded { - NSLog("Warning: Ampli is already initialized. Ampli.instance.load() should be called once at application start up.") - return - } - - var apiKey: String? - - if let clientApiKey = options.client?.apiKey { - apiKey = clientApiKey - } else if let environment = options.environment { - apiKey = ApiKey[environment] - } - - if let instance = options.client?.instance { - self.amplitude = instance - } else if let apiKey = apiKey { - let configuration = options.client?.config?.configuration ?? Configuration( - apiKey: apiKey - ) - if configuration.plan == nil { - configuration.plan = AmpliObservePlan - } - if configuration.ingestionMetadata == nil { - configuration.ingestionMetadata = IngestionMetadata( - sourceName: "ios-swift-ampli-v2", sourceVersion: "1.0.0" - ) - } - self.amplitude = Amplitude(configuration: configuration) - } else { - NSLog("ampli.load() requires 'environment', 'client.apiKey', or 'client.instance'") - return - } - } - - public func track(_ event: Event, options: EventOptions? = nil) -> Void { - if !isInitializedAndEnabled() { - return - } - let eventOptions = getEventOptions(event.options, options) - amplitude?.track(eventType: event.eventType, eventProperties: event.eventProperties, options: eventOptions) - } - - public func identify(_ userId: String?, _ event: Identify, options: EventOptions? = nil) -> Void { - if !isInitializedAndEnabled() { - return - } - let eventOptions = getEventOptions(event.options, options, userId) - amplitude?.identify(userProperties: event.eventProperties, options: eventOptions) - } - - public func flush() -> Void { - if !isInitializedAndEnabled() { - return - } - amplitude?.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 - */ - public func eventNoProperties() { - self.track(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 - - - Parameter requiredObject: Property Object Type - - Parameter requiredObjectArray: Property Object Array Type - */ - public func eventObjectTypes( - requiredObject: Any, - requiredObjectArray: [Any] - ) { - self.track(EventObjectTypes( - requiredObject: requiredObject, - requiredObjectArray: requiredObjectArray - )) - } - - /** - 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 - - - Parameter requiredArray: Event 2 Property - Array - - Parameter requiredBoolean: Event 2 Property - Boolean - - Parameter requiredEnum: Event 2 Property - Enum - - Parameter requiredInteger: Event 2 Property - Integer * * Examples: * 5, 4, 3 - - Parameter requiredNumber: Event 2 Property - Number - - Parameter requiredString: Event 2 Property - String - - Parameter optionalString: Event 2 Property - Optional String * * Examples: * Some string, or another - */ - public func eventWithAllProperties( - requiredArray: [String], - requiredBoolean: Bool, - requiredEnum: EventWithAllProperties.RequiredEnum, - requiredInteger: Int, - requiredNumber: Double, - requiredString: String, - optionalString: String? = nil - ) { - self.track(EventWithAllProperties( - requiredArray: requiredArray, - requiredBoolean: requiredBoolean, - requiredEnum: requiredEnum, - requiredInteger: requiredInteger, - requiredNumber: requiredNumber, - requiredString: requiredString, - optionalString: optionalString - )) - } - - /** - 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 - - - Parameter requiredBooleanArray: description for required boolean array - - Parameter requiredEnumArray: Description for enum array property - - Parameter requiredNumberArray: Description for required number array - - Parameter requiredObjectArray: Description for required object array - - Parameter requiredStringArray: description for required string array - */ - public func eventWithArrayTypes( - requiredBooleanArray: [Bool], - requiredEnumArray: [String], - requiredNumberArray: [Double], - requiredObjectArray: [Any], - requiredStringArray: [String] - ) { - self.track(EventWithArrayTypes( - requiredBooleanArray: requiredBooleanArray, - requiredEnumArray: requiredEnumArray, - requiredNumberArray: requiredNumberArray, - requiredObjectArray: requiredObjectArray, - requiredStringArray: requiredStringArray - )) - } - - /** - 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 - */ - public func eventWithConstTypes() { - self.track(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 - - - Parameter requiredEnum: Description for optional enum - - Parameter optionalEnum: Description for required enum - */ - public func eventWithEnumTypes( - requiredEnum: EventWithEnumTypes.RequiredEnum, - optionalEnum: EventWithEnumTypes.OptionalEnum? = nil - ) { - self.track(EventWithEnumTypes( - requiredEnum: requiredEnum, - optionalEnum: optionalEnum - )) - } - - /** - 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 - - - Parameter optionalBooleanArray: Description for optional boolean array - - Parameter optionalEnumArray: Description for optional enum array - - Parameter optionalJsonArray: Description for optional object array - - Parameter optionalNumberArray: Description for optional number array - - Parameter optionalStringArray: Description for optional string array - */ - public func eventWithOptionalArrayTypes( - optionalBooleanArray: [Bool]? = nil, - optionalEnumArray: [String]? = nil, - optionalJsonArray: [Any]? = nil, - optionalNumberArray: [Double]? = nil, - optionalStringArray: [String]? = nil - ) { - self.track(EventWithOptionalArrayTypes( - optionalBooleanArray: optionalBooleanArray, - optionalEnumArray: optionalEnumArray, - optionalJsonArray: optionalJsonArray, - optionalNumberArray: optionalNumberArray, - optionalStringArray: optionalStringArray - )) - } - - /** - 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 - - - Parameter optionalArrayNumber: Property has no description provided in tracking plan. - - Parameter optionalArrayString: Property has no description provided in tracking plan. - - Parameter optionalBoolean: Property has no description provided in tracking plan. - - Parameter optionalNumber: Property has no description provided in tracking plan. - - Parameter optionalString: Optional String property description - */ - public func eventWithOptionalProperties( - optionalArrayNumber: [Double]? = nil, - optionalArrayString: [String]? = nil, - optionalBoolean: Bool? = nil, - optionalNumber: Double? = nil, - optionalString: String? = nil - ) { - self.track(EventWithOptionalProperties( - optionalArrayNumber: optionalArrayNumber, - optionalArrayString: optionalArrayString, - optionalBoolean: optionalBoolean, - optionalNumber: optionalNumber, - optionalString: optionalString - )) - } - - /** - 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 - - - Parameter requiredEventProperty: required_event_property description - - Parameter requiredTemplateProperty: required_template_property description - - Parameter optionalEventProperty: optional_event_property description - - Parameter optionalTemplateProperty: optional_template_property description - */ - public func eventWithTemplateProperties( - requiredEventProperty: String, - requiredTemplateProperty: String, - optionalEventProperty: Double? = nil, - optionalTemplateProperty: Double? = nil - ) { - self.track(EventWithTemplateProperties( - requiredEventProperty: requiredEventProperty, - requiredTemplateProperty: requiredTemplateProperty, - optionalEventProperty: optionalEventProperty, - optionalTemplateProperty: optionalTemplateProperty - )) - } - - /** - 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 - - - Parameter enumWithSpace: Description for enum with space - - Parameter enumSnakeCase: description_for_enum_snake_case - - Parameter enumCamelCase: descriptionForEnumCamelCase - - Parameter enumPascalCase: DescirptionForEnumPascalCase - - Parameter propertyWithSpace: Description for case with space - - Parameter propertyWithSnakeCase: Description_for_snake_case - - Parameter propertyWithCamelCase: descriptionForCamelCase - - Parameter propertyWithPascalCase: DescriptionForPascalCase - */ - public func eventWithDifferentCasingTypes( - enumWithSpace: EventWithDifferentCasingTypes.EnumWithSpace, - enumSnakeCase: EventWithDifferentCasingTypes.EnumSnakeCase, - enumCamelCase: EventWithDifferentCasingTypes.EnumCamelCase, - enumPascalCase: EventWithDifferentCasingTypes.EnumPascalCase, - propertyWithSpace: String, - propertyWithSnakeCase: String, - propertyWithCamelCase: String, - propertyWithPascalCase: String - ) { - self.track(EventWithDifferentCasingTypes( - enumWithSpace: enumWithSpace, - enumSnakeCase: enumSnakeCase, - enumCamelCase: enumCamelCase, - enumPascalCase: enumPascalCase, - propertyWithSpace: propertyWithSpace, - propertyWithSnakeCase: propertyWithSnakeCase, - propertyWithCamelCase: propertyWithCamelCase, - propertyWithPascalCase: propertyWithPascalCase - )) - } - - /** - 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 - - - Parameter intMax10: property to test schema validation - */ - public func eventMaxIntForTest( - intMax10: Int - ) { - self.track(EventMaxIntForTest( - intMax10: intMax10 - )) - } - - private func getEventOptions(_ options: EventOptions?, _ overrideOptions: EventOptions?, _ overrideUserId: String? = nil) -> EventOptions { - let dummyEvent = BaseEvent(eventType: "dummy") - if let options = options { - dummyEvent.mergeEventOptions(eventOptions: options) - } - if let overrideOptions = overrideOptions { - dummyEvent.mergeEventOptions(eventOptions: overrideOptions) - } - if let overrideUserId = overrideUserId { - dummyEvent.userId = overrideUserId - } - return dummyEvent - } -} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleApp.entitlements b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleApp.entitlements deleted file mode 100644 index f2ef3ae0..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleApp.entitlements +++ /dev/null @@ -1,10 +0,0 @@ - - - - - com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-only - - - diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleAppApp.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleAppApp.swift deleted file mode 100644 index 96c95bcc..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/AmpliSwiftSampleAppApp.swift +++ /dev/null @@ -1,10 +0,0 @@ -import SwiftUI - -@main -struct AmpliSwiftSampleAppApp: App { - var body: some Scene { - WindowGroup { - ContentView() - } - } -} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json deleted file mode 100644 index eb878970..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "colors" : [ - { - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 532cd729..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "platform" : "ios", - "size" : "1024x1024" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "16x16" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "16x16" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "32x32" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "32x32" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "128x128" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "128x128" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "256x256" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "256x256" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "512x512" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "512x512" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/Contents.json b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/Contents.json deleted file mode 100644 index 73c00596..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/ContentView.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/ContentView.swift deleted file mode 100644 index f54deaba..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/ContentView.swift +++ /dev/null @@ -1,19 +0,0 @@ -import SwiftUI - -struct ContentView: View { - var body: some View { - VStack { - Image(systemName: "globe") - .imageScale(.large) - .foregroundColor(.accentColor) - Text("Hello, world!") - } - .padding() - } -} - -struct ContentView_Previews: PreviewProvider { - static var previews: some View { - ContentView() - } -} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Preview Content/Preview Assets.xcassets/Contents.json b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Preview Content/Preview Assets.xcassets/Contents.json deleted file mode 100644 index 73c00596..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp/Preview Content/Preview Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliSwiftSampleAppTests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliSwiftSampleAppTests.swift deleted file mode 100644 index f45f790c..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliSwiftSampleAppTests.swift +++ /dev/null @@ -1,28 +0,0 @@ -import XCTest - -final class AmpliSwiftSampleAppTests: XCTestCase { - - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - // Any test you write for XCTest can be annotated as throws and async. - // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. - // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. - } - - func testPerformanceExample() throws { - // This is an example of a performance test case. - measure { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITests.swift deleted file mode 100644 index c17d7cd9..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITests.swift +++ /dev/null @@ -1,34 +0,0 @@ -import XCTest - -final class AmpliSwiftSampleAppUITests: XCTestCase { - - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - - // In UI tests it is usually best to stop immediately when a failure occurs. - continueAfterFailure = false - - // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() throws { - // UI tests must launch the application that they test. - let app = XCUIApplication() - app.launch() - - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testLaunchPerformance() throws { - if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { - // This measures how long it takes to launch your application. - measure(metrics: [XCTApplicationLaunchMetric()]) { - XCUIApplication().launch() - } - } - } -} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITestsLaunchTests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITestsLaunchTests.swift deleted file mode 100644 index 973c43ed..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppUITests/AmpliSwiftSampleAppUITestsLaunchTests.swift +++ /dev/null @@ -1,25 +0,0 @@ -import XCTest - -final class AmpliSwiftSampleAppUITestsLaunchTests: XCTestCase { - - override class var runsForEachTargetApplicationUIConfiguration: Bool { - true - } - - override func setUpWithError() throws { - continueAfterFailure = false - } - - func testLaunch() throws { - let app = XCUIApplication() - app.launch() - - // Insert steps here to perform after app launch but before taking a screenshot, - // such as logging into a test account or navigating somewhere in the app - - let attachment = XCTAttachment(screenshot: app.screenshot()) - attachment.name = "Launch Screen" - attachment.lifetime = .keepAlways - add(attachment) - } -} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/ampli.json b/ios/swift/v2/AmpliSwiftSampleApp/ampli.json deleted file mode 100644 index 36ddbac0..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/ampli.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "Zone": "us", - "OrgId": "132559", - "WorkspaceId": "77b37977-cb3a-42eb-bce3-09f5f7c3adb7", - "SourceId": "ff1de76c-80bb-42ea-8d39-63402f588c7f", - "Runtime": "ios:swift-ampli-v2", - "Platform": "iOS", - "Language": "Swift", - "SDK": "Amplitude-Swift ~> 1.0", - "Branch": "main", - "Version": "1.0.0", - "VersionId": "a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c", - "Path": "./AmpliSwiftSampleApp/Ampli", - "OmitApiKeys": true -} \ No newline at end of file From 3d3ea6da1b86efa7b80830bdc2c2ae010e4d8464 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Wed, 9 Aug 2023 20:40:13 +0400 Subject: [PATCH 09/21] AMP-63100 Swift v2 app: v1 copy --- .../project.pbxproj | 804 +++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../AmpliSwiftSampleApp (iOS).xcscheme | 95 ++ .../AmpliSwiftSampleAppTests.xcscheme | 52 + .../contents.xcworkspacedata | 10 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../AmpliSwiftSampleAppTests/AmpliTests.swift | 207 ++++ ios/swift/v2/AmpliSwiftSampleApp/Gemfile | 3 + ios/swift/v2/AmpliSwiftSampleApp/Podfile | 28 + ios/swift/v2/AmpliSwiftSampleApp/README.md | 33 + .../Shared/Ampli/Ampli.swift | 949 ++++++++++++++++++ .../.xccurrentversion | 8 + .../Shared.xcdatamodel/contents | 9 + .../Shared/AmpliSwiftSampleAppApp.swift | 126 +++ .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 148 +++ .../Shared/Assets.xcassets/Contents.json | 6 + .../Shared/ContentView.swift | 93 ++ .../Shared/Persistence.swift | 55 + .../AmpliSwiftSampleApp/Shared/TextView.swift | 30 + ios/swift/v2/AmpliSwiftSampleApp/ampli.json | 14 + .../macOS/macOS.entitlements | 10 + 23 files changed, 2714 insertions(+) create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleAppTests.xcscheme create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Gemfile create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Podfile create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/README.md create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/.xccurrentversion create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/Shared.xcdatamodel/contents create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Shared/Assets.xcassets/Contents.json create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Shared/ContentView.swift create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Shared/Persistence.swift create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Shared/TextView.swift create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/ampli.json create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/macOS/macOS.entitlements diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj new file mode 100644 index 00000000..fd1243e5 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj @@ -0,0 +1,804 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + 3E3B5FB02758045C003D95E1 /* AmpliTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3B5FAF2758045C003D95E1 /* AmpliTests.swift */; }; + 3E3B5FB227583BC9003D95E1 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3B5FB127583BC9003D95E1 /* TextView.swift */; }; + 3E3B5FB327583BC9003D95E1 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3B5FB127583BC9003D95E1 /* TextView.swift */; }; + 3ECE2C3E273F7B6C004EAA2C /* AmpliSwiftSampleApp.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C2B273F7B65004EAA2C /* AmpliSwiftSampleApp.xcdatamodeld */; }; + 3ECE2C3F273F7B6C004EAA2C /* AmpliSwiftSampleApp.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C2B273F7B65004EAA2C /* AmpliSwiftSampleApp.xcdatamodeld */; }; + 3ECE2C40273F7B6C004EAA2C /* AmpliSwiftSampleAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C2D273F7B65004EAA2C /* AmpliSwiftSampleAppApp.swift */; }; + 3ECE2C41273F7B6C004EAA2C /* AmpliSwiftSampleAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C2D273F7B65004EAA2C /* AmpliSwiftSampleAppApp.swift */; }; + 3ECE2C42273F7B6C004EAA2C /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C2E273F7B65004EAA2C /* ContentView.swift */; }; + 3ECE2C43273F7B6C004EAA2C /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C2E273F7B65004EAA2C /* ContentView.swift */; }; + 3ECE2C44273F7B6C004EAA2C /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C2F273F7B65004EAA2C /* Persistence.swift */; }; + 3ECE2C45273F7B6C004EAA2C /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C2F273F7B65004EAA2C /* Persistence.swift */; }; + 3ECE2C46273F7B6C004EAA2C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3ECE2C30273F7B6C004EAA2C /* Assets.xcassets */; }; + 3ECE2C47273F7B6C004EAA2C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3ECE2C30273F7B6C004EAA2C /* Assets.xcassets */; }; + 3ECE2C532743332C004EAA2C /* Ampli.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C512743332C004EAA2C /* Ampli.swift */; }; + 3ECE2C542743332C004EAA2C /* Ampli.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C512743332C004EAA2C /* Ampli.swift */; }; + 82EA982A8CF090351192BDC5 /* libPods-AmpliSwiftSampleApp (iOS).a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DA67EDD533A140301A0ED6F /* libPods-AmpliSwiftSampleApp (iOS).a */; }; + DF74438E59F388DE0D5312C3 /* libPods-AmpliSwiftSampleAppTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FCF67013EA39835ADF064D05 /* libPods-AmpliSwiftSampleAppTests.a */; }; + F8D20984CBA9F9E8B7274DBB /* libPods-AmpliSwiftSampleApp (macOS).a in Frameworks */ = {isa = PBXBuildFile; fileRef = D320B081553D038DE2C3451F /* libPods-AmpliSwiftSampleApp (macOS).a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 3E3B5FAA275803D3003D95E1 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3ECE2C26273F7B65004EAA2C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3ECE2C34273F7B6C004EAA2C; + remoteInfo = "AmpliSwiftSampleApp (iOS)"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1034F176E7CCBA34DE4EB867 /* Pods-AmpliSwiftSampleAppTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleAppTests.debug.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleAppTests/Pods-AmpliSwiftSampleAppTests.debug.xcconfig"; sourceTree = ""; }; + 2EE7856BA77896084D17D495 /* Pods-AmpliSwiftSampleApp (iOS).release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleApp (iOS).release.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleApp (iOS)/Pods-AmpliSwiftSampleApp (iOS).release.xcconfig"; sourceTree = ""; }; + 3E3B5FA6275803D3003D95E1 /* AmpliSwiftSampleAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AmpliSwiftSampleAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3E3B5FAF2758045C003D95E1 /* AmpliTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliTests.swift; sourceTree = ""; }; + 3E3B5FB127583BC9003D95E1 /* TextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = ""; }; + 3ECE2C2C273F7B65004EAA2C /* Shared.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Shared.xcdatamodel; sourceTree = ""; }; + 3ECE2C2D273F7B65004EAA2C /* AmpliSwiftSampleAppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliSwiftSampleAppApp.swift; sourceTree = ""; }; + 3ECE2C2E273F7B65004EAA2C /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 3ECE2C2F273F7B65004EAA2C /* Persistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = ""; }; + 3ECE2C30273F7B6C004EAA2C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 3ECE2C35273F7B6C004EAA2C /* AmpliSwiftSampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AmpliSwiftSampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 3ECE2C3B273F7B6C004EAA2C /* AmpliSwiftSampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AmpliSwiftSampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 3ECE2C3D273F7B6C004EAA2C /* macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macOS.entitlements; sourceTree = ""; }; + 3ECE2C512743332C004EAA2C /* Ampli.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Ampli.swift; sourceTree = ""; }; + 4874785F85542D07984AFD54 /* Pods-AmpliSwiftSampleAppTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleAppTests.release.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleAppTests/Pods-AmpliSwiftSampleAppTests.release.xcconfig"; sourceTree = ""; }; + 9DA67EDD533A140301A0ED6F /* libPods-AmpliSwiftSampleApp (iOS).a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AmpliSwiftSampleApp (iOS).a"; sourceTree = BUILT_PRODUCTS_DIR; }; + AA54015EF375CC8893FEC6CC /* Pods-AmpliSwiftSampleApp (macOS).release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleApp (macOS).release.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleApp (macOS)/Pods-AmpliSwiftSampleApp (macOS).release.xcconfig"; sourceTree = ""; }; + D0BAADDDB89B39695FCD3EDF /* Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleApp (macOS)/Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig"; sourceTree = ""; }; + D320B081553D038DE2C3451F /* libPods-AmpliSwiftSampleApp (macOS).a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AmpliSwiftSampleApp (macOS).a"; sourceTree = BUILT_PRODUCTS_DIR; }; + FC778F7F39B4D2F8F3596B35 /* Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleApp (iOS)/Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig"; sourceTree = ""; }; + FCF67013EA39835ADF064D05 /* libPods-AmpliSwiftSampleAppTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AmpliSwiftSampleAppTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3E3B5FA3275803D3003D95E1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + DF74438E59F388DE0D5312C3 /* libPods-AmpliSwiftSampleAppTests.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3ECE2C32273F7B6C004EAA2C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 82EA982A8CF090351192BDC5 /* libPods-AmpliSwiftSampleApp (iOS).a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3ECE2C38273F7B6C004EAA2C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F8D20984CBA9F9E8B7274DBB /* libPods-AmpliSwiftSampleApp (macOS).a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3E3B5FA7275803D3003D95E1 /* AmpliSwiftSampleAppTests */ = { + isa = PBXGroup; + children = ( + 3E3B5FAF2758045C003D95E1 /* AmpliTests.swift */, + ); + path = AmpliSwiftSampleAppTests; + sourceTree = ""; + }; + 3ECE2C25273F7B65004EAA2C = { + isa = PBXGroup; + children = ( + 3ECE2C2A273F7B65004EAA2C /* Shared */, + 3ECE2C3C273F7B6C004EAA2C /* macOS */, + 3E3B5FA7275803D3003D95E1 /* AmpliSwiftSampleAppTests */, + 3ECE2C36273F7B6C004EAA2C /* Products */, + B8E184F982BAB6A9F0F2440E /* Pods */, + F0B610FBE681A3D6E6570E2C /* Frameworks */, + ); + sourceTree = ""; + }; + 3ECE2C2A273F7B65004EAA2C /* Shared */ = { + isa = PBXGroup; + children = ( + 3ECE2C502743332C004EAA2C /* Ampli */, + 3ECE2C2D273F7B65004EAA2C /* AmpliSwiftSampleAppApp.swift */, + 3E3B5FB127583BC9003D95E1 /* TextView.swift */, + 3ECE2C2E273F7B65004EAA2C /* ContentView.swift */, + 3ECE2C2F273F7B65004EAA2C /* Persistence.swift */, + 3ECE2C30273F7B6C004EAA2C /* Assets.xcassets */, + 3ECE2C2B273F7B65004EAA2C /* AmpliSwiftSampleApp.xcdatamodeld */, + ); + path = Shared; + sourceTree = ""; + }; + 3ECE2C36273F7B6C004EAA2C /* Products */ = { + isa = PBXGroup; + children = ( + 3ECE2C35273F7B6C004EAA2C /* AmpliSwiftSampleApp.app */, + 3ECE2C3B273F7B6C004EAA2C /* AmpliSwiftSampleApp.app */, + 3E3B5FA6275803D3003D95E1 /* AmpliSwiftSampleAppTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 3ECE2C3C273F7B6C004EAA2C /* macOS */ = { + isa = PBXGroup; + children = ( + 3ECE2C3D273F7B6C004EAA2C /* macOS.entitlements */, + ); + path = macOS; + sourceTree = ""; + }; + 3ECE2C502743332C004EAA2C /* Ampli */ = { + isa = PBXGroup; + children = ( + 3ECE2C512743332C004EAA2C /* Ampli.swift */, + ); + path = Ampli; + sourceTree = ""; + }; + B8E184F982BAB6A9F0F2440E /* Pods */ = { + isa = PBXGroup; + children = ( + FC778F7F39B4D2F8F3596B35 /* Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig */, + 2EE7856BA77896084D17D495 /* Pods-AmpliSwiftSampleApp (iOS).release.xcconfig */, + D0BAADDDB89B39695FCD3EDF /* Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig */, + AA54015EF375CC8893FEC6CC /* Pods-AmpliSwiftSampleApp (macOS).release.xcconfig */, + 1034F176E7CCBA34DE4EB867 /* Pods-AmpliSwiftSampleAppTests.debug.xcconfig */, + 4874785F85542D07984AFD54 /* Pods-AmpliSwiftSampleAppTests.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + F0B610FBE681A3D6E6570E2C /* Frameworks */ = { + isa = PBXGroup; + children = ( + 9DA67EDD533A140301A0ED6F /* libPods-AmpliSwiftSampleApp (iOS).a */, + D320B081553D038DE2C3451F /* libPods-AmpliSwiftSampleApp (macOS).a */, + FCF67013EA39835ADF064D05 /* libPods-AmpliSwiftSampleAppTests.a */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 3E3B5FA5275803D3003D95E1 /* AmpliSwiftSampleAppTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3E3B5FAE275803D3003D95E1 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleAppTests" */; + buildPhases = ( + 5AAE05862366F33457B6CB7A /* [CP] Check Pods Manifest.lock */, + 3E3B5FA2275803D3003D95E1 /* Sources */, + 3E3B5FA3275803D3003D95E1 /* Frameworks */, + 3E3B5FA4275803D3003D95E1 /* Resources */, + 37352C7584693F14DD5FEB62 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + 3E3B5FAB275803D3003D95E1 /* PBXTargetDependency */, + ); + name = AmpliSwiftSampleAppTests; + productName = AmpliSwiftSampleAppTests; + productReference = 3E3B5FA6275803D3003D95E1 /* AmpliSwiftSampleAppTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 3ECE2C34273F7B6C004EAA2C /* AmpliSwiftSampleApp (iOS) */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3ECE2C4A273F7B6C004EAA2C /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleApp (iOS)" */; + buildPhases = ( + 47870903BBE4154AF2CAF117 /* [CP] Check Pods Manifest.lock */, + 3ECE2C31273F7B6C004EAA2C /* Sources */, + 3ECE2C32273F7B6C004EAA2C /* Frameworks */, + 3ECE2C33273F7B6C004EAA2C /* Resources */, + 02C2383AF5D122603C7E0077 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "AmpliSwiftSampleApp (iOS)"; + productName = "AmpliSwiftSampleApp (iOS)"; + productReference = 3ECE2C35273F7B6C004EAA2C /* AmpliSwiftSampleApp.app */; + productType = "com.apple.product-type.application"; + }; + 3ECE2C3A273F7B6C004EAA2C /* AmpliSwiftSampleApp (macOS) */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3ECE2C4D273F7B6C004EAA2C /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleApp (macOS)" */; + buildPhases = ( + D3903C8E82AE1D3F9503D24A /* [CP] Check Pods Manifest.lock */, + 3ECE2C37273F7B6C004EAA2C /* Sources */, + 3ECE2C38273F7B6C004EAA2C /* Frameworks */, + 3ECE2C39273F7B6C004EAA2C /* Resources */, + 90AFC11CB08FA6327F233DAE /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "AmpliSwiftSampleApp (macOS)"; + productName = "AmpliSwiftSampleApp (macOS)"; + productReference = 3ECE2C3B273F7B6C004EAA2C /* AmpliSwiftSampleApp.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 3ECE2C26273F7B65004EAA2C /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1310; + LastUpgradeCheck = 1310; + TargetAttributes = { + 3E3B5FA5275803D3003D95E1 = { + CreatedOnToolsVersion = 13.1; + TestTargetID = 3ECE2C34273F7B6C004EAA2C; + }; + 3ECE2C34273F7B6C004EAA2C = { + CreatedOnToolsVersion = 13.1; + }; + 3ECE2C3A273F7B6C004EAA2C = { + CreatedOnToolsVersion = 13.1; + }; + }; + }; + buildConfigurationList = 3ECE2C29273F7B65004EAA2C /* Build configuration list for PBXProject "AmpliSwiftSampleApp" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 3ECE2C25273F7B65004EAA2C; + productRefGroup = 3ECE2C36273F7B6C004EAA2C /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 3ECE2C34273F7B6C004EAA2C /* AmpliSwiftSampleApp (iOS) */, + 3ECE2C3A273F7B6C004EAA2C /* AmpliSwiftSampleApp (macOS) */, + 3E3B5FA5275803D3003D95E1 /* AmpliSwiftSampleAppTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 3E3B5FA4275803D3003D95E1 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3ECE2C33273F7B6C004EAA2C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3ECE2C46273F7B6C004EAA2C /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3ECE2C39273F7B6C004EAA2C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3ECE2C47273F7B6C004EAA2C /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 02C2383AF5D122603C7E0077 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleApp (iOS)/Pods-AmpliSwiftSampleApp (iOS)-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleApp (iOS)/Pods-AmpliSwiftSampleApp (iOS)-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleApp (iOS)/Pods-AmpliSwiftSampleApp (iOS)-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 37352C7584693F14DD5FEB62 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleAppTests/Pods-AmpliSwiftSampleAppTests-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleAppTests/Pods-AmpliSwiftSampleAppTests-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleAppTests/Pods-AmpliSwiftSampleAppTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 47870903BBE4154AF2CAF117 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-AmpliSwiftSampleApp (iOS)-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 5AAE05862366F33457B6CB7A /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-AmpliSwiftSampleAppTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 90AFC11CB08FA6327F233DAE /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleApp (macOS)/Pods-AmpliSwiftSampleApp (macOS)-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleApp (macOS)/Pods-AmpliSwiftSampleApp (macOS)-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleApp (macOS)/Pods-AmpliSwiftSampleApp (macOS)-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + D3903C8E82AE1D3F9503D24A /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-AmpliSwiftSampleApp (macOS)-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 3E3B5FA2275803D3003D95E1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3E3B5FB02758045C003D95E1 /* AmpliTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3ECE2C31273F7B6C004EAA2C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3ECE2C3E273F7B6C004EAA2C /* AmpliSwiftSampleApp.xcdatamodeld in Sources */, + 3ECE2C44273F7B6C004EAA2C /* Persistence.swift in Sources */, + 3ECE2C532743332C004EAA2C /* Ampli.swift in Sources */, + 3E3B5FB227583BC9003D95E1 /* TextView.swift in Sources */, + 3ECE2C40273F7B6C004EAA2C /* AmpliSwiftSampleAppApp.swift in Sources */, + 3ECE2C42273F7B6C004EAA2C /* ContentView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3ECE2C37273F7B6C004EAA2C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3ECE2C3F273F7B6C004EAA2C /* AmpliSwiftSampleApp.xcdatamodeld in Sources */, + 3ECE2C45273F7B6C004EAA2C /* Persistence.swift in Sources */, + 3ECE2C542743332C004EAA2C /* Ampli.swift in Sources */, + 3E3B5FB327583BC9003D95E1 /* TextView.swift in Sources */, + 3ECE2C41273F7B6C004EAA2C /* AmpliSwiftSampleAppApp.swift in Sources */, + 3ECE2C43273F7B6C004EAA2C /* ContentView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 3E3B5FAB275803D3003D95E1 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3ECE2C34273F7B6C004EAA2C /* AmpliSwiftSampleApp (iOS) */; + targetProxy = 3E3B5FAA275803D3003D95E1 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 3E3B5FAC275803D3003D95E1 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1034F176E7CCBA34DE4EB867 /* Pods-AmpliSwiftSampleAppTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleAppTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AmpliSwiftSampleApp.app/AmpliSwiftSampleApp"; + }; + name = Debug; + }; + 3E3B5FAD275803D3003D95E1 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4874785F85542D07984AFD54 /* Pods-AmpliSwiftSampleAppTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleAppTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AmpliSwiftSampleApp.app/AmpliSwiftSampleApp"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 3ECE2C48273F7B6C004EAA2C /* 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; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 3ECE2C49273F7B6C004EAA2C /* 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; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 3ECE2C4B273F7B6C004EAA2C /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FC778F7F39B4D2F8F3596B35 /* Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleApp; + PRODUCT_NAME = AmpliSwiftSampleApp; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 3ECE2C4C273F7B6C004EAA2C /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 2EE7856BA77896084D17D495 /* Pods-AmpliSwiftSampleApp (iOS).release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleApp; + PRODUCT_NAME = AmpliSwiftSampleApp; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 3ECE2C4E273F7B6C004EAA2C /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D0BAADDDB89B39695FCD3EDF /* Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = macOS/macOS.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 12.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleApp; + PRODUCT_NAME = AmpliSwiftSampleApp; + SDKROOT = macosx; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 3ECE2C4F273F7B6C004EAA2C /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AA54015EF375CC8893FEC6CC /* Pods-AmpliSwiftSampleApp (macOS).release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = macOS/macOS.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 12.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.amplitude.AmpliSwiftSampleApp; + PRODUCT_NAME = AmpliSwiftSampleApp; + SDKROOT = macosx; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 3E3B5FAE275803D3003D95E1 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleAppTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3E3B5FAC275803D3003D95E1 /* Debug */, + 3E3B5FAD275803D3003D95E1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3ECE2C29273F7B65004EAA2C /* Build configuration list for PBXProject "AmpliSwiftSampleApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3ECE2C48273F7B6C004EAA2C /* Debug */, + 3ECE2C49273F7B6C004EAA2C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3ECE2C4A273F7B6C004EAA2C /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleApp (iOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3ECE2C4B273F7B6C004EAA2C /* Debug */, + 3ECE2C4C273F7B6C004EAA2C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3ECE2C4D273F7B6C004EAA2C /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleApp (macOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3ECE2C4E273F7B6C004EAA2C /* Debug */, + 3ECE2C4F273F7B6C004EAA2C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCVersionGroup section */ + 3ECE2C2B273F7B65004EAA2C /* AmpliSwiftSampleApp.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + 3ECE2C2C273F7B65004EAA2C /* Shared.xcdatamodel */, + ); + currentVersion = 3ECE2C2C273F7B65004EAA2C /* Shared.xcdatamodel */; + path = AmpliSwiftSampleApp.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; +/* End XCVersionGroup section */ + }; + rootObject = 3ECE2C26273F7B65004EAA2C /* Project object */; +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme new file mode 100644 index 00000000..ecf2397d --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleApp (iOS).xcscheme @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleAppTests.xcscheme b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleAppTests.xcscheme new file mode 100644 index 00000000..be2261d7 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliSwiftSampleAppTests.xcscheme @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..24de21e1 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift new file mode 100644 index 00000000..f1d9aa24 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift @@ -0,0 +1,207 @@ +// +// AmpliTests.swift +// AmpliSwiftSampleAppTests +// +// Created by Qingzhuo Zhen on 12/1/21. +// + +import XCTest +import AmpliSwiftSampleApp +import Amplitude + +let emptyDictionary = [String: String]() +func isEmptyDictionary(_ dict: Any?) -> Bool { + return NSDictionary(dictionary: dict as! [String: String]).isEqual(to: emptyDictionary) +} + +class AmpliTests: XCTestCase { + private var ampli: Ampli? + private var middlewareRun: XCTestExpectation? + + override func setUpWithError() throws { + ampli = Ampli() + middlewareRun = expectation(description: "Waiting") + } + + func initAmpliWithNewInstance(_ instanceName: String) { + let client = Amplitude.instance(withName: instanceName); + client.initializeApiKey("test-api-key"); + ampli?.load(LoadOptions(client: LoadClientOptions(instance: client))) + } + + func testIdentify() throws { + let userId = "test-user-id"; + let deviceId = "test-device-id"; + + initAmpliWithNewInstance("testIdentify") + + let identifyProperties = Identify(requiredNumber: 22.0, optionalArray: ["optional array str"]) + let eventOptions = EventOptions(deviceId: deviceId) + + ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in + XCTAssertEqual(payload.event["event_type"] as! String, "$identify") + XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"])) + XCTAssertEqual(payload.event["user_id"] as! String, userId) + XCTAssertEqual(payload.event["device_id"] as! String, deviceId) + self.middlewareRun?.fulfill() + }) + ampli?.identify(userId, identifyProperties, options: eventOptions) + ampli?.flush() + + let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + } + + func testIdentifyUserIdOnEvent() { + initAmpliWithNewInstance("testIdentifyUserIdOnEvent") + + let eventOptionsUserId = "test-user-id-options" + let deviceId = "test-device-id" + let identifyProperties = Identify(requiredNumber: 22.0, optionalArray: ["optional array str"]) + let eventOptions = EventOptions(deviceId: deviceId, userId: eventOptionsUserId) + + ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in + XCTAssertEqual(payload.event["event_type"] as! String, "$identify") + XCTAssertEqual(payload.event["user_id"] as! String, eventOptionsUserId) + XCTAssertEqual(payload.event["device_id"] as! String, deviceId) + XCTAssertEqual(self.ampli?.client.userId, eventOptionsUserId) + self.middlewareRun?.fulfill() + }) + + ampli?.identify(nil, identifyProperties, options: eventOptions) + ampli?.flush() + + let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + + } + + func testTrackWithNoProperties() throws { + initAmpliWithNewInstance("testTrackWithNoProperties") + + ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in + XCTAssertEqual(payload.event["event_type"] as! String, "Event No Properties") + XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"])) +// XCTAssertNil(payload.event["user_id"]) +// XCTAssertNotNil(payload.event["device_id"]) + self.middlewareRun?.fulfill() + }) + ampli?.eventNoProperties() + ampli?.flush() + + let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + } + + func testTrackEventWithAllTypes() throws { + let userId = "test-user-id"; + let deviceId = "test-device-id"; + let eventOptions = EventOptions(deviceId: deviceId) + let extraDict: MiddlewareExtra = ["test" : "extra test"]; + + initAmpliWithNewInstance("testTrackEventWithAllTypes") + + ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in + XCTAssertEqual(payload.event["event_type"] as! String, "Event With All Properties") + let eventProperties = payload.event["event_properties"] as? Dictionary + XCTAssertEqual(eventProperties!["requiredArray"] as! Array, ["array element 1", "array element 2"]) + XCTAssertEqual(eventProperties!["requiredBoolean"] as! Bool, true) + XCTAssertEqual(eventProperties!["requiredEnum"] as! String, "Enum1") + XCTAssertEqual(eventProperties!["requiredInteger"] as! Int, 10) + XCTAssertEqual(eventProperties!["requiredNumber"] as! Double, 2.0) + XCTAssertEqual(eventProperties!["requiredString"] as! String, "required string") + XCTAssertNil(eventProperties!["optionalString"]) + XCTAssertEqual(payload.event["user_id"] as! String, userId) + XCTAssertEqual(payload.event["device_id"] as! String, deviceId) + self.middlewareRun?.fulfill() + }) + ampli?.track( + EventWithAllProperties( + requiredArray: ["array element 1", "array element 2"], + requiredBoolean: true, + requiredEnum: EventWithAllProperties.RequiredEnum.enum1, + requiredInteger: 10, + requiredNumber: 2.0, + requiredString: "required string" + ).options(userId: userId), + options: eventOptions, + extra: extraDict + ) + ampli?.flush() + + let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + } + + func testSetGroup() throws { + let groupType = "test-group-type"; + let groupName = "test-group"; + + initAmpliWithNewInstance("testSetGroup") + + ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in + XCTAssertEqual(payload.event["event_type"] as! String, "$identify") + XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"])) + let userProperties = payload.event["user_properties"] as? Dictionary + let userPropertiesSet = userProperties!["$set"] as? Dictionary + XCTAssertEqual(userPropertiesSet![groupType] as! String, groupName) + self.middlewareRun?.fulfill() + }) + ampli?.client.setGroup(groupType, groupName: groupName as NSObject) + ampli?.flush() + + let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + } + + func testGroupIdentify() throws { + let groupType = "test-group-type"; + let groupName = "test-group"; + + initAmpliWithNewInstance("testGroupIdentify") + + ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in + XCTAssertEqual(payload.event["event_type"] as! String, "$groupidentify") + XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"])) + XCTAssertTrue(isEmptyDictionary(payload.event["user_properties"])) + let groups = payload.event["groups"] as? Dictionary + XCTAssertEqual(groups![groupType] as! String, groupName) + let groupProperties = payload.event["group_properties"] as? Dictionary + let groupPropertiesSet = groupProperties!["$set"] as? Dictionary + XCTAssertEqual(groupPropertiesSet!["requiredBoolean"] as! Bool, false) + XCTAssertEqual(groupPropertiesSet!["optionalString"] as! String, "optional str") + self.middlewareRun?.fulfill() + }) + + let identifyArgs = AMPIdentify() + identifyArgs.set("requiredBoolean", value: false as NSObject) + identifyArgs.set("optionalString", value: "optional str" as NSObject) + ampli?.client.groupIdentify(withGroupType: groupType, groupName: groupName as NSObject, groupIdentify: identifyArgs) + ampli?.flush() + + let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + } + + func testGroupIdentifyNilOptionalString() throws { + let groupType = "test-group-type"; + let groupName = "test-group"; + + initAmpliWithNewInstance("testGroupIdentifyNilOptionalString") + + ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in + XCTAssertEqual(payload.event["event_type"] as! String, "$groupidentify") + XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"])) + XCTAssertTrue(isEmptyDictionary(payload.event["user_properties"])) + let groups = payload.event["groups"] as? Dictionary + XCTAssertEqual(groups![groupType] as! String, groupName) + let groupProperties = payload.event["group_properties"] as? Dictionary + let groupPropertiesSet = groupProperties!["$set"] as? Dictionary + XCTAssertEqual(groupPropertiesSet!["requiredBoolean"] as! Bool, false) + XCTAssertNil(groupPropertiesSet!["optionalString"]) + self.middlewareRun?.fulfill() + }) + + let identifyArgs = AMPIdentify() + identifyArgs.set("requiredBoolean", value: false as NSObject) + identifyArgs.set("optionalString", value: nil) + ampli?.client.groupIdentify(withGroupType: groupType, groupName: groupName as NSObject, groupIdentify: identifyArgs) + ampli?.flush() + + let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Gemfile b/ios/swift/v2/AmpliSwiftSampleApp/Gemfile new file mode 100644 index 00000000..538c58aa --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'cocoapods', '~>1.1' diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Podfile b/ios/swift/v2/AmpliSwiftSampleApp/Podfile new file mode 100644 index 00000000..42a91f1b --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Podfile @@ -0,0 +1,28 @@ +def import_pods + +pod 'Amplitude', "~> 8.13.0" + +end + +inhibit_all_warnings! + +target 'AmpliSwiftSampleApp (iOS)' do + project "AmpliSwiftSampleApp" + platform :ios, '15.0' + + import_pods +end + +target 'AmpliSwiftSampleApp (macOS)' do + platform :macos, '12.0' + project "AmpliSwiftSampleApp" + + import_pods +end + +target 'AmpliSwiftSampleAppTests' do + platform :ios, '15.0' + project "AmpliSwiftSampleApp" + + import_pods +end diff --git a/ios/swift/v2/AmpliSwiftSampleApp/README.md b/ios/swift/v2/AmpliSwiftSampleApp/README.md new file mode 100644 index 00000000..9497f8cf --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/README.md @@ -0,0 +1,33 @@ +# Ampli iOS SDK (Swift) +An example app using the Ampli Swift SDK + +# 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. `pod install` +3. Open `AmpliSwiftSampleApp.xcworkspace` 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 `AmpliSwiftSampleAppApp`, `TextView.swift` or `ContentView.swift` to use the events from your tracking plan + +# Project structure +* README.md - you are here * +* Podfile - pods dependency +* Shared/ + * [AmpliSwiftSampleAppApp](Shared/AmpliSwiftSampleAppApp.swift) - Example user app using Ampli SDK. A good place to start. + * [TextView](Shared/TextView.swift) - Example user app using Ampli SDK. A good place to start. + * [ContentView](Shared/ContentView.swift) - Example user app using Ampli SDK. A good place to start. + * Ampli/ + * [Ampli.swift](Shared/Ampli/Ampli.swift) - Generated SDK, don't modify by hand. Update with `ampli pull` diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift new file mode 100644 index 00000000..221f005c --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift @@ -0,0 +1,949 @@ +/** + * Ampli - A strong typed wrapper for your Analytics + * + * This file is generated by Amplitude. + * To update run 'ampli pull swift-ampli' + * + * Required dependencies: Amplitude ~> 8.10 + * Tracking Plan Version: 1 + * Build: 1.0.0 + * Runtime: ios:swift-ampli + * + * [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/swift-ampli) + */ + +import Foundation +import Amplitude + +public typealias MiddlewareExtra = [String: Any] + +public enum AmpliEnvironment: Int { + case prod, dev +} + +let ApiKey: [AmpliEnvironment: String] = [ + .prod: "", + .dev: "" +] + +let AmpliObservePlan = AMPPlan() + .setBranch("main") + .setSource("swift-ampli") + .setVersion("1") + .setVersionId("a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c") + +public class Event { + public let eventType: String + public let eventProperties: [String:Any]? + public let options: EventOptions? + + init(eventType: String, eventProperties: [String:Any?]?, options: EventOptions?) { + self.eventType = eventType + self.eventProperties = eventProperties?.compactMapValues { $0 } + self.options = options + } +} + +public class GenericEvent : Event { + private let eventFactory: (_ eventProperties: [String: Any?]?, _ options: EventOptions?) -> E + + init(eventType: String, eventProperties: [String:Any?]?, options: EventOptions?, eventFactory: @escaping (_ eventProperties: [String: Any?]?, _ options: EventOptions?) -> E) { + self.eventFactory = eventFactory + super.init(eventType: eventType, eventProperties: eventProperties, options: options) + } + + public func options(_ options: EventOptions) -> E { + return self.eventFactory(self.eventProperties, options) + } + + public func options(deviceId: String? = nil, userId: String? = nil) -> E { + return self.options(EventOptions(deviceId: deviceId, userId: userId)) + } +} + +public class Identify : GenericEvent { + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { + super.init( + eventType: "$identify", + eventProperties: eventProperties, + options: options, + eventFactory: Identify.init + ) + } + + /** + Identify properties. + + - Parameter requiredNumber: Description for identify requiredNumber + - Parameter optionalArray: Description for identify optionalArray + */ + public convenience init( + requiredNumber: Double, + optionalArray: [String]? = nil + ) { + self.init([ + "optionalArray": optionalArray, + "requiredNumber": requiredNumber + ]) + } +} + +public class EventNoProperties : GenericEvent { + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { + super.init( + eventType: "Event No Properties", + eventProperties: eventProperties, + options: options, + eventFactory: EventNoProperties.init + ) + } + + /** + Event w no properties description + + Owner: Test codegen + */ + public convenience init() { + self.init(nil) + } +} + +public class EventObjectTypes : GenericEvent { + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { + super.init( + eventType: "Event Object Types", + eventProperties: eventProperties, + options: options, + eventFactory: EventObjectTypes.init + ) + } + + /** + Event with Object and Object Array + + Owner: Test codegen + + - Parameter requiredObject: Property Object Type + - Parameter requiredObjectArray: Property Object Array Type + */ + public convenience init( + requiredObject: Any, + requiredObjectArray: [Any] + ) { + self.init([ + "requiredObject": requiredObject, + "requiredObjectArray": requiredObjectArray + ]) + } +} + +public class EventWithAllProperties : GenericEvent { + + public enum RequiredEnum: String { + case enum1 = "Enum1" + case enum2 = "Enum2" + } + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { + super.init( + eventType: "Event With All Properties", + eventProperties: eventProperties, + options: options, + eventFactory: EventWithAllProperties.init + ) + } + + /** + Event w all properties description + + Owner: Test codegen + + - Parameter requiredArray: Event 2 Property - Array + - Parameter requiredBoolean: Event 2 Property - Boolean + - Parameter requiredEnum: Event 2 Property - Enum + - Parameter requiredInteger: Event 2 Property - Integer * * Examples: * 5, 4, 3 + - Parameter requiredNumber: Event 2 Property - Number + - Parameter requiredString: Event 2 Property - String + - Parameter optionalString: Event 2 Property - Optional String * * Examples: * Some string, or another + */ + public convenience init( + requiredArray: [String], + requiredBoolean: Bool, + requiredEnum: EventWithAllProperties.RequiredEnum, + requiredInteger: Int, + requiredNumber: Double, + requiredString: String, + optionalString: String? = nil + ) { + self.init([ + "optionalString": optionalString, + "requiredArray": requiredArray, + "requiredBoolean": requiredBoolean, + "requiredConst": "some-const-value", + "requiredEnum": requiredEnum.rawValue, + "requiredInteger": requiredInteger, + "requiredNumber": requiredNumber, + "requiredString": requiredString + ]) + } +} + +public class EventWithArrayTypes : GenericEvent { + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { + super.init( + eventType: "Event With Array Types", + eventProperties: eventProperties, + options: options, + eventFactory: EventWithArrayTypes.init + ) + } + + /** + Description for event with Array Types + + Owner: Test codegen + + - Parameter requiredBooleanArray: description for required boolean array + - Parameter requiredEnumArray: Description for enum array property + - Parameter requiredNumberArray: Description for required number array + - Parameter requiredObjectArray: Description for required object array + - Parameter requiredStringArray: description for required string array + */ + public convenience init( + requiredBooleanArray: [Bool], + requiredEnumArray: [String], + requiredNumberArray: [Double], + requiredObjectArray: [Any], + requiredStringArray: [String] + ) { + self.init([ + "requiredBooleanArray": requiredBooleanArray, + "requiredEnumArray": requiredEnumArray, + "requiredNumberArray": requiredNumberArray, + "requiredObjectArray": requiredObjectArray, + "requiredStringArray": requiredStringArray + ]) + } +} + +public class EventWithConstTypes : GenericEvent { + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { + super.init( + eventType: "Event With Const Types", + eventProperties: eventProperties, + options: options, + eventFactory: EventWithConstTypes.init + ) + } + + /** + Description for event with const types + + Owner: Test codegen + */ + public convenience init() { + self.init([ + "Boolean Const": true, + "Integer Const": 10, + "Number Const": 2.2, + "String Const": "String-Constant", + "String Const WIth Quotes": "\"String \"Const With\" Quotes\"", + "String Int Const": 0 + ]) + } +} + +public class EventWithEnumTypes : GenericEvent { + + public enum OptionalEnum: String { + case optionalEnum1 = "optional enum 1" + case optionalEnum2 = "optional enum 2" + } + + public enum RequiredEnum: String { + case requiredEnum1 = "required enum 1" + case requiredEnum2 = "required enum 2" + } + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { + super.init( + eventType: "Event With Enum Types", + eventProperties: eventProperties, + options: options, + eventFactory: EventWithEnumTypes.init + ) + } + + /** + Description for event with enum types + + Owner: Test codegen + + - Parameter requiredEnum: Description for optional enum + - Parameter optionalEnum: Description for required enum + */ + public convenience init( + requiredEnum: EventWithEnumTypes.RequiredEnum, + optionalEnum: EventWithEnumTypes.OptionalEnum? = nil + ) { + self.init([ + "optional enum": optionalEnum?.rawValue, + "required enum": requiredEnum.rawValue + ]) + } +} + +public class EventWithOptionalArrayTypes : GenericEvent { + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { + super.init( + eventType: "Event With Optional Array Types", + eventProperties: eventProperties, + options: options, + eventFactory: EventWithOptionalArrayTypes.init + ) + } + + /** + Description for event with optional array types + + Owner: Test codegen + + - Parameter optionalBooleanArray: Description for optional boolean array + - Parameter optionalEnumArray: Description for optional enum array + - Parameter optionalJsonArray: Description for optional object array + - Parameter optionalNumberArray: Description for optional number array + - Parameter optionalStringArray: Description for optional string array + */ + public convenience init( + optionalBooleanArray: [Bool]? = nil, + optionalEnumArray: [String]? = nil, + optionalJsonArray: [Any]? = nil, + optionalNumberArray: [Double]? = nil, + optionalStringArray: [String]? = nil + ) { + self.init([ + "optionalBooleanArray": optionalBooleanArray, + "optionalEnumArray": optionalEnumArray, + "optionalJSONArray": optionalJsonArray, + "optionalNumberArray": optionalNumberArray, + "optionalStringArray": optionalStringArray + ]) + } +} + +public class EventWithOptionalProperties : GenericEvent { + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { + super.init( + eventType: "Event With Optional Properties", + eventProperties: eventProperties, + options: options, + eventFactory: EventWithOptionalProperties.init + ) + } + + /** + Event w optional properties description + + Owner: Test codegen + + - Parameter optionalArrayNumber: Property has no description provided in tracking plan. + - Parameter optionalArrayString: Property has no description provided in tracking plan. + - Parameter optionalBoolean: Property has no description provided in tracking plan. + - Parameter optionalNumber: Property has no description provided in tracking plan. + - Parameter optionalString: Optional String property description + */ + public convenience init( + optionalArrayNumber: [Double]? = nil, + optionalArrayString: [String]? = nil, + optionalBoolean: Bool? = nil, + optionalNumber: Double? = nil, + optionalString: String? = nil + ) { + self.init([ + "optionalArrayNumber": optionalArrayNumber, + "optionalArrayString": optionalArrayString, + "optionalBoolean": optionalBoolean, + "optionalNumber": optionalNumber, + "optionalString": optionalString + ]) + } +} + +public class EventWithTemplateProperties : GenericEvent { + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { + super.init( + eventType: "Event With Template Properties", + eventProperties: eventProperties, + options: options, + eventFactory: EventWithTemplateProperties.init + ) + } + + /** + Event with template properties description + + Owner: Test codegen + + - Parameter requiredEventProperty: required_event_property description + - Parameter requiredTemplateProperty: required_template_property description + - Parameter optionalEventProperty: optional_event_property description + - Parameter optionalTemplateProperty: optional_template_property description + */ + public convenience init( + requiredEventProperty: String, + requiredTemplateProperty: String, + optionalEventProperty: Double? = nil, + optionalTemplateProperty: Double? = nil + ) { + self.init([ + "optional_event_property": optionalEventProperty, + "optional_template_property": optionalTemplateProperty, + "required_event_property": requiredEventProperty, + "required_template_property": requiredTemplateProperty + ]) + } +} + +public class EventWithDifferentCasingTypes : GenericEvent { + + public enum EnumWithSpace: String { + case enumWithSpace = "enum with space" + } + + public enum EnumSnakeCase: String { + case enumSnakeCase = "enum_snake_case" + } + + public enum EnumCamelCase: String { + case enumCamelCase = "enumCamelCase" + } + + public enum EnumPascalCase: String { + case enumPascalCase = "EnumPascalCase" + } + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { + super.init( + eventType: "event withDifferent_CasingTypes", + eventProperties: eventProperties, + options: options, + eventFactory: EventWithDifferentCasingTypes.init + ) + } + + /** + Description for case with space + + Owner: Test codegen + + - Parameter enumWithSpace: Description for enum with space + - Parameter enumSnakeCase: description_for_enum_snake_case + - Parameter enumCamelCase: descriptionForEnumCamelCase + - Parameter enumPascalCase: DescirptionForEnumPascalCase + - Parameter propertyWithSpace: Description for case with space + - Parameter propertyWithSnakeCase: Description_for_snake_case + - Parameter propertyWithCamelCase: descriptionForCamelCase + - Parameter propertyWithPascalCase: DescriptionForPascalCase + */ + public convenience init( + enumWithSpace: EventWithDifferentCasingTypes.EnumWithSpace, + enumSnakeCase: EventWithDifferentCasingTypes.EnumSnakeCase, + enumCamelCase: EventWithDifferentCasingTypes.EnumCamelCase, + enumPascalCase: EventWithDifferentCasingTypes.EnumPascalCase, + propertyWithSpace: String, + propertyWithSnakeCase: String, + propertyWithCamelCase: String, + propertyWithPascalCase: String + ) { + self.init([ + "enum with space": enumWithSpace.rawValue, + "enum_snake_case": enumSnakeCase.rawValue, + "enumCamelCase": enumCamelCase.rawValue, + "EnumPascalCase": enumPascalCase.rawValue, + "property with space": propertyWithSpace, + "property_with_snake_case": propertyWithSnakeCase, + "propertyWithCamelCase": propertyWithCamelCase, + "PropertyWithPascalCase": propertyWithPascalCase + ]) + } +} + +public class EventMaxIntForTest : GenericEvent { + + private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) { + super.init( + eventType: "EventMaxIntForTest", + eventProperties: eventProperties, + options: options, + eventFactory: EventMaxIntForTest.init + ) + } + + /** + Event to test schema validation + + Owner: Test codegen + + - Parameter intMax10: property to test schema validation + */ + public convenience init( + intMax10: Int + ) { + self.init([ + "intMax10": intMax10 + ]) + } +} + +public struct LoadClientConfig { + public let plan: AMPPlan? + + public init(plan: AMPPlan? = nil) { + self.plan = plan + } +} + +public struct LoadClientOptions { + public let apiKey: String? + public let instance: Amplitude? + public let config: LoadClientConfig? + + public init(apiKey: String? = nil, instance: Amplitude? = nil, config: LoadClientConfig? = nil) { + self.apiKey = apiKey + self.instance = instance + self.config = config + } +} + +public struct LoadOptions { + public let environment: AmpliEnvironment? + public let disabled: Bool? + public let client: LoadClientOptions? + + public init(environment: AmpliEnvironment? = nil, disabled: Bool? = nil, client: LoadClientOptions? = nil) { + self.environment = environment + self.disabled = disabled + self.client = client + } +} + +public struct EventOptions { + public let deviceId: String? + public let userId: String? + + public init(deviceId: String? = nil, userId: String? = nil) { + self.deviceId = deviceId + self.userId = userId + } +} + +public class Ampli { + private var amplitude: Amplitude? + public var client: Amplitude { + get { + _ = isInitializedAndEnabled() + return amplitude! + } + } + + public var isLoaded: Bool { + get { + return self.amplitude != nil + } + } + + public private(set) var disabled: Bool + + public static let instance: Ampli = Ampli() + + public init() { + disabled = false + } + + private func isInitializedAndEnabled() -> Bool { + if !self.isLoaded { + NSLog("Ampli is not yet initialized. Have you called `ampli.load()` on app start?") + return false + } + return !self.disabled + } + + // options should have 'environment', 'client.api_key' or 'client.instance' + public func load(_ options: LoadOptions) -> Void { + self.disabled = options.disabled ?? false + if (self.isLoaded) { + NSLog("Warning: Ampli is already initialized. Ampli.instance.load() should be called once at application start up.") + return + } + + var apiKey: String? + + if (options.client?.apiKey != nil) { + apiKey = options.client?.apiKey + } else if (options.environment != nil) { + apiKey = ApiKey[options.environment!] + } + + if (options.client?.instance != nil) { + self.amplitude = options.client?.instance + } else if (apiKey != nil) { + self.amplitude = Amplitude.instance() + self.amplitude?.initializeApiKey(apiKey!) + } else { + NSLog("ampli.load() requires 'environment', 'client.apiKey', or 'client.instance'") + return + } + + self.amplitude?.setPlan(options.client?.config?.plan ?? AmpliObservePlan!) + + // set ingestionMetadata information + let AmpliExtrasMiddleware = AMPBlockMiddleware { (payload, next) in + let ingestionMetadata: NSMutableDictionary = [ + "source_name": "ios-swift-ampli", + "source_version": "1.0.0" + ] + payload.event["ingestion_metadata"] = ingestionMetadata + // Continue to next middleware + next(payload) + } + self.amplitude?.addEventMiddleware(AmpliExtrasMiddleware) + } + + public func track(_ event: Event, options: EventOptions? = nil, extra: MiddlewareExtra? = nil) -> Void { + if (!isInitializedAndEnabled()) { + return + } + self.handleEventOptions(event.options, options) + amplitude?.logEvent(event.eventType, withEventProperties: event.eventProperties, withMiddlewareExtra: extra as? NSMutableDictionary) + } + + public func identify(_ userId: String?, _ event: Identify, options: EventOptions? = nil, extra: MiddlewareExtra? = nil) -> Void { + if (!isInitializedAndEnabled()) { + return + } + self.handleEventOptions(event.options, options, userId) + + let identifyArgs = AMPIdentify() + event.eventProperties?.forEach{ key, value in + identifyArgs.set(key, value: value as? NSObject) + } + + amplitude?.identify(identifyArgs) + } + + public func flush() -> Void { + if (!isInitializedAndEnabled()) { + return + } + amplitude?.uploadEvents() + } + + /** + 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 + */ + public func eventNoProperties() { + self.track(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 + + - Parameter requiredObject: Property Object Type + - Parameter requiredObjectArray: Property Object Array Type + */ + public func eventObjectTypes( + requiredObject: Any, + requiredObjectArray: [Any] + ) { + self.track(EventObjectTypes( + requiredObject: requiredObject, + requiredObjectArray: requiredObjectArray + )) + } + + /** + 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 + + - Parameter requiredArray: Event 2 Property - Array + - Parameter requiredBoolean: Event 2 Property - Boolean + - Parameter requiredEnum: Event 2 Property - Enum + - Parameter requiredInteger: Event 2 Property - Integer * * Examples: * 5, 4, 3 + - Parameter requiredNumber: Event 2 Property - Number + - Parameter requiredString: Event 2 Property - String + - Parameter optionalString: Event 2 Property - Optional String * * Examples: * Some string, or another + */ + public func eventWithAllProperties( + requiredArray: [String], + requiredBoolean: Bool, + requiredEnum: EventWithAllProperties.RequiredEnum, + requiredInteger: Int, + requiredNumber: Double, + requiredString: String, + optionalString: String? = nil + ) { + self.track(EventWithAllProperties( + requiredArray: requiredArray, + requiredBoolean: requiredBoolean, + requiredEnum: requiredEnum, + requiredInteger: requiredInteger, + requiredNumber: requiredNumber, + requiredString: requiredString, + optionalString: optionalString + )) + } + + /** + 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 + + - Parameter requiredBooleanArray: description for required boolean array + - Parameter requiredEnumArray: Description for enum array property + - Parameter requiredNumberArray: Description for required number array + - Parameter requiredObjectArray: Description for required object array + - Parameter requiredStringArray: description for required string array + */ + public func eventWithArrayTypes( + requiredBooleanArray: [Bool], + requiredEnumArray: [String], + requiredNumberArray: [Double], + requiredObjectArray: [Any], + requiredStringArray: [String] + ) { + self.track(EventWithArrayTypes( + requiredBooleanArray: requiredBooleanArray, + requiredEnumArray: requiredEnumArray, + requiredNumberArray: requiredNumberArray, + requiredObjectArray: requiredObjectArray, + requiredStringArray: requiredStringArray + )) + } + + /** + 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 + */ + public func eventWithConstTypes() { + self.track(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 + + - Parameter requiredEnum: Description for optional enum + - Parameter optionalEnum: Description for required enum + */ + public func eventWithEnumTypes( + requiredEnum: EventWithEnumTypes.RequiredEnum, + optionalEnum: EventWithEnumTypes.OptionalEnum? = nil + ) { + self.track(EventWithEnumTypes( + requiredEnum: requiredEnum, + optionalEnum: optionalEnum + )) + } + + /** + 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 + + - Parameter optionalBooleanArray: Description for optional boolean array + - Parameter optionalEnumArray: Description for optional enum array + - Parameter optionalJsonArray: Description for optional object array + - Parameter optionalNumberArray: Description for optional number array + - Parameter optionalStringArray: Description for optional string array + */ + public func eventWithOptionalArrayTypes( + optionalBooleanArray: [Bool]? = nil, + optionalEnumArray: [String]? = nil, + optionalJsonArray: [Any]? = nil, + optionalNumberArray: [Double]? = nil, + optionalStringArray: [String]? = nil + ) { + self.track(EventWithOptionalArrayTypes( + optionalBooleanArray: optionalBooleanArray, + optionalEnumArray: optionalEnumArray, + optionalJsonArray: optionalJsonArray, + optionalNumberArray: optionalNumberArray, + optionalStringArray: optionalStringArray + )) + } + + /** + 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 + + - Parameter optionalArrayNumber: Property has no description provided in tracking plan. + - Parameter optionalArrayString: Property has no description provided in tracking plan. + - Parameter optionalBoolean: Property has no description provided in tracking plan. + - Parameter optionalNumber: Property has no description provided in tracking plan. + - Parameter optionalString: Optional String property description + */ + public func eventWithOptionalProperties( + optionalArrayNumber: [Double]? = nil, + optionalArrayString: [String]? = nil, + optionalBoolean: Bool? = nil, + optionalNumber: Double? = nil, + optionalString: String? = nil + ) { + self.track(EventWithOptionalProperties( + optionalArrayNumber: optionalArrayNumber, + optionalArrayString: optionalArrayString, + optionalBoolean: optionalBoolean, + optionalNumber: optionalNumber, + optionalString: optionalString + )) + } + + /** + 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 + + - Parameter requiredEventProperty: required_event_property description + - Parameter requiredTemplateProperty: required_template_property description + - Parameter optionalEventProperty: optional_event_property description + - Parameter optionalTemplateProperty: optional_template_property description + */ + public func eventWithTemplateProperties( + requiredEventProperty: String, + requiredTemplateProperty: String, + optionalEventProperty: Double? = nil, + optionalTemplateProperty: Double? = nil + ) { + self.track(EventWithTemplateProperties( + requiredEventProperty: requiredEventProperty, + requiredTemplateProperty: requiredTemplateProperty, + optionalEventProperty: optionalEventProperty, + optionalTemplateProperty: optionalTemplateProperty + )) + } + + /** + 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 + + - Parameter enumWithSpace: Description for enum with space + - Parameter enumSnakeCase: description_for_enum_snake_case + - Parameter enumCamelCase: descriptionForEnumCamelCase + - Parameter enumPascalCase: DescirptionForEnumPascalCase + - Parameter propertyWithSpace: Description for case with space + - Parameter propertyWithSnakeCase: Description_for_snake_case + - Parameter propertyWithCamelCase: descriptionForCamelCase + - Parameter propertyWithPascalCase: DescriptionForPascalCase + */ + public func eventWithDifferentCasingTypes( + enumWithSpace: EventWithDifferentCasingTypes.EnumWithSpace, + enumSnakeCase: EventWithDifferentCasingTypes.EnumSnakeCase, + enumCamelCase: EventWithDifferentCasingTypes.EnumCamelCase, + enumPascalCase: EventWithDifferentCasingTypes.EnumPascalCase, + propertyWithSpace: String, + propertyWithSnakeCase: String, + propertyWithCamelCase: String, + propertyWithPascalCase: String + ) { + self.track(EventWithDifferentCasingTypes( + enumWithSpace: enumWithSpace, + enumSnakeCase: enumSnakeCase, + enumCamelCase: enumCamelCase, + enumPascalCase: enumPascalCase, + propertyWithSpace: propertyWithSpace, + propertyWithSnakeCase: propertyWithSnakeCase, + propertyWithCamelCase: propertyWithCamelCase, + propertyWithPascalCase: propertyWithPascalCase + )) + } + + /** + 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 + + - Parameter intMax10: property to test schema validation + */ + public func eventMaxIntForTest( + intMax10: Int + ) { + self.track(EventMaxIntForTest( + intMax10: intMax10 + )) + } + + private func handleEventOptions(_ options: EventOptions?, _ overrideOptions: EventOptions?, _ overrideUserId: String? = nil) { + let userId = overrideUserId ?? overrideOptions?.userId ?? options?.userId + if (userId != nil) { + amplitude?.setUserId(userId) + } + + let deviceId = overrideOptions?.deviceId ?? options?.deviceId + if (deviceId != nil) { + amplitude?.setDeviceId(deviceId!) + } + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/.xccurrentversion b/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/.xccurrentversion new file mode 100644 index 00000000..775cb510 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/.xccurrentversion @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + Shared.xcdatamodel + + diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/Shared.xcdatamodel/contents b/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/Shared.xcdatamodel/contents new file mode 100644 index 00000000..9ed2921a --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleApp.xcdatamodeld/Shared.xcdatamodel/contents @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift new file mode 100644 index 00000000..0c14d3e1 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift @@ -0,0 +1,126 @@ +// +// AmpliSwiftSampleAppApp.swift +// Shared +// +// Created by Qingzhuo Zhen on 11/12/21. +// + +import SwiftUI +import Amplitude + +@main +struct AmpliSwiftSampleAppApp: App { + let persistenceController = PersistenceController.shared + + var body: some Scene { + // '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 + // + // OR Specify a AmpliEnvironment + // ampli.load(LoadOptions(environment: AmpliEnvironment.development) + // + // OR Provide a specific Amplitude API key + // ampli.load(LoadOptions(client: LoadClientOptions(apiKey: "Custom api key")) + // + // OR Use an existing Amplitude instance + // requires "import Amplitude" + // let instance = Amplitude.instance("instanceName"); + // instance.initializeApiKey("Custom api key"); + // ampli.load(LoadOptions(client: LoadClientOptions(instance: instance))) + // + // For testing you can disable ampli + // ampli.load(LoadOptions(disabled: ENV.IS_TESTING ? true: false)) + // + // Make as many Ampli instances as you want + // let ampli2 = new Ampli(); + // ampli2.load(LoadOptions(client: LoadClientOptions(apiKey: "api-key-2"))) + + let apiKey = ProcessInfo.processInfo.environment["AMPLITUDE_API_KEY"] ?? "test-api-key"; + let ampli = Ampli.instance + let extraDict = ["test" : "extra test"]; + + // Load + ampli.load(LoadOptions(client: LoadClientOptions(apiKey: apiKey))) + + // Add Middleware + let loggingMiddleware = AMPBlockMiddleware { (payload, next) in + // Output event and extra from payload + print(String(format:"[ampli] event=\(payload.event) payload=\(String(describing: payload.extra))")) + // Continue to next middleware + next(payload); + } + ampli.client.addEventMiddleware(loggingMiddleware) + + // Identify + ampli.identify("ampli-swift-user", Identify(requiredNumber: 22.0, optionalArray: ["optional string"])) + + // Set group + ampli.client.setGroup("ampli group type", groupName: "ampli swift group" as NSObject) + + // GroupIdentify + let identifyArgs = AMPIdentify() + identifyArgs.set("requiredBoolean", value: true as NSObject) + ampli.client.groupIdentify(withGroupType: "ampli group type", groupName: "ampli swift group" as NSObject, groupIdentify: identifyArgs) + + // Track events with dedicated event methods + ampli.eventNoProperties() + ampli.eventMaxIntForTest(intMax10: 20) + ampli.eventWithConstTypes() + + // Track using event instances and ampli.track(event, options, extra) + let eventWithAllProperties = EventWithAllProperties( + requiredArray: ["array element 1", "array element 2"], + requiredBoolean: true, + requiredEnum: EventWithAllProperties.RequiredEnum.enum1, + requiredInteger: 10, + requiredNumber: 2.0, + requiredString: "required string", + optionalString: nil + ) + ampli.track(eventWithAllProperties, extra: extraDict) + + ampli.eventObjectTypes( + requiredObject: 3, + requiredObjectArray: [1, true, "string"] + ) + + ampli.eventWithEnumTypes( + requiredEnum: EventWithEnumTypes.RequiredEnum.requiredEnum2 + ) + + ampli.eventWithOptionalArrayTypes( + optionalBooleanArray: [false, true] + ) + + ampli.eventWithOptionalProperties( + optionalString: "optional string" + ) + + ampli.eventWithDifferentCasingTypes( + enumWithSpace: EventWithDifferentCasingTypes.EnumWithSpace.enumWithSpace, + enumSnakeCase: EventWithDifferentCasingTypes.EnumSnakeCase.enumSnakeCase, + enumCamelCase: EventWithDifferentCasingTypes.EnumCamelCase.enumCamelCase, + enumPascalCase: EventWithDifferentCasingTypes.EnumPascalCase.enumPascalCase, + propertyWithSpace: "property with space", + propertyWithSnakeCase: "property with snake case", + propertyWithCamelCase: "property with camel case", + propertyWithPascalCase: "property with pascal case" + ) + + ampli.eventWithTemplateProperties( + requiredEventProperty: "event property", + requiredTemplateProperty: "template property", + optionalEventProperty: 1.23 + ) + + ampli.client.uploadEvents(); + + return WindowGroup { + ContentView() + .environment(\.managedObjectContext, persistenceController.container.viewContext) + TextView() + } + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..c136eaff --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,148 @@ +{ + "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" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Assets.xcassets/Contents.json b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/ContentView.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/ContentView.swift new file mode 100644 index 00000000..e6dd96ab --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/ContentView.swift @@ -0,0 +1,93 @@ +// +// ContentView.swift +// Shared +// +// Created by Qingzhuo Zhen on 11/12/21. +// + +import SwiftUI +import CoreData + +struct ContentView: View { + @Environment(\.managedObjectContext) private var viewContext + + @FetchRequest( + sortDescriptors: [NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)], + animation: .default) + private var items: FetchedResults + private var ampli: Ampli = Ampli.instance + + + var body: some View { + NavigationView { + List { + ForEach(items) { item in + NavigationLink { + Text("Item at \(item.timestamp!, formatter: itemFormatter)") + } label: { + Text(item.timestamp!, formatter: itemFormatter) + } + } + .onDelete(perform: deleteItems) + } + .toolbar { +#if os(iOS) + ToolbarItem(placement: .navigationBarTrailing) { + EditButton() + } +#endif + ToolbarItem { + Button(action: addItem) { + Label("Add Item With Event Sent", systemImage: "plus") + } + } + } + Text("Select an item") + } + } + + private func addItem() { + ampli.eventMaxIntForTest(intMax10: 9) + withAnimation { + let newItem = Item(context: viewContext) + newItem.timestamp = Date() + + do { + try viewContext.save() + } catch { + // Replace this implementation with code to handle the error appropriately. + // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + let nsError = error as NSError + fatalError("Unresolved error \(nsError), \(nsError.userInfo)") + } + } + } + + private func deleteItems(offsets: IndexSet) { + withAnimation { + offsets.map { items[$0] }.forEach(viewContext.delete) + + do { + try viewContext.save() + } catch { + // Replace this implementation with code to handle the error appropriately. + // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + let nsError = error as NSError + fatalError("Unresolved error \(nsError), \(nsError.userInfo)") + } + } + } +} + +private let itemFormatter: DateFormatter = { + let formatter = DateFormatter() + formatter.dateStyle = .short + formatter.timeStyle = .medium + return formatter +}() + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView().environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Persistence.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Persistence.swift new file mode 100644 index 00000000..2c6004e2 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Persistence.swift @@ -0,0 +1,55 @@ +// +// Persistence.swift +// Shared +// +// Created by Qingzhuo Zhen on 11/12/21. +// + +import CoreData + +struct PersistenceController { + static let shared = PersistenceController() + + static var preview: PersistenceController = { + let result = PersistenceController(inMemory: true) + let viewContext = result.container.viewContext + for _ in 0..<10 { + let newItem = Item(context: viewContext) + newItem.timestamp = Date() + } + do { + try viewContext.save() + } catch { + // Replace this implementation with code to handle the error appropriately. + // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + let nsError = error as NSError + fatalError("Unresolved error \(nsError), \(nsError.userInfo)") + } + return result + }() + + let container: NSPersistentContainer + + init(inMemory: Bool = false) { + container = NSPersistentContainer(name: "AmpliSwiftSampleApp") + if inMemory { + container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null") + } + container.loadPersistentStores(completionHandler: { (storeDescription, error) in + if let error = error as NSError? { + // Replace this implementation with code to handle the error appropriately. + // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + + /* + Typical reasons for an error here include: + * The parent directory does not exist, cannot be created, or disallows writing. + * The persistent store is not accessible, due to permissions or data protection when the device is locked. + * The device is out of space. + * The store could not be migrated to the current model version. + Check the error message to determine what the actual problem was. + */ + fatalError("Unresolved error \(error), \(error.userInfo)") + } + }) + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/TextView.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/TextView.swift new file mode 100644 index 00000000..7cc3dd7b --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/TextView.swift @@ -0,0 +1,30 @@ +// +// TextView.swift +// AmpliSwiftSampleApp +// +// Created by Qingzhuo Zhen on 12/1/21. +// + +import SwiftUI + +struct TextView: View { + var body: some View { + let ampli = Ampli.instance + + ampli.eventWithArrayTypes( + requiredBooleanArray: [true], + requiredEnumArray: ["Enum1"], + requiredNumberArray: [5.0, 6.0], + requiredObjectArray: [["key1": "value1"], ["key2": "value2"]], + requiredStringArray: ["string1", "string2"] + ) + + return Text("Welcome to Ampli Swift!") + } +} + +struct TextView_Previews: PreviewProvider { + static var previews: some View { + TextView() + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/ampli.json b/ios/swift/v2/AmpliSwiftSampleApp/ampli.json new file mode 100644 index 00000000..b2c22d5e --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/ampli.json @@ -0,0 +1,14 @@ +{ + "OrgId": "132559", + "WorkspaceId": "77b37977-cb3a-42eb-bce3-09f5f7c3adb7", + "SourceId": "2c9d4579-657b-4eac-a989-cdb3e3daf39f", + "Path": "./Shared/Ampli", + "Branch": "main", + "Version": "1.0.0", + "Runtime": "ios:swift-ampli", + "VersionId": "a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c", + "OmitApiKeys": true, + "Platform": "iOS", + "Language": "Swift", + "SDK": "Amplitude ~> 8.8.0" +} \ No newline at end of file diff --git a/ios/swift/v2/AmpliSwiftSampleApp/macOS/macOS.entitlements b/ios/swift/v2/AmpliSwiftSampleApp/macOS/macOS.entitlements new file mode 100644 index 00000000..f2ef3ae0 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/macOS/macOS.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + From 4319baee2eadc838c4114f419bf87ba7b3ec77c7 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Thu, 10 Aug 2023 12:18:12 +0400 Subject: [PATCH 10/21] AMP-63100 Swift v2 app: update and tests --- .../project.pbxproj | 66 +---- .../AmpliSwiftSampleAppTests/AmpliTests.swift | 277 +++++++++--------- ios/swift/v2/AmpliSwiftSampleApp/Podfile | 2 +- .../Shared/Ampli/Ampli.swift | 137 ++++----- .../Shared/AmpliSwiftSampleAppApp.swift | 40 +-- .../Shared/Plugins/LoggingPlugin.swift | 25 ++ ios/swift/v2/AmpliSwiftSampleApp/ampli.json | 6 +- 7 files changed, 254 insertions(+), 299 deletions(-) create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Shared/Plugins/LoggingPlugin.swift diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj index fd1243e5..91b4c064 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj @@ -23,6 +23,7 @@ 3ECE2C532743332C004EAA2C /* Ampli.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C512743332C004EAA2C /* Ampli.swift */; }; 3ECE2C542743332C004EAA2C /* Ampli.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C512743332C004EAA2C /* Ampli.swift */; }; 82EA982A8CF090351192BDC5 /* libPods-AmpliSwiftSampleApp (iOS).a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DA67EDD533A140301A0ED6F /* libPods-AmpliSwiftSampleApp (iOS).a */; }; + BA4436A82A84CCE4002F1115 /* LoggingPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA4436A72A84CCE4002F1115 /* LoggingPlugin.swift */; }; DF74438E59F388DE0D5312C3 /* libPods-AmpliSwiftSampleAppTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FCF67013EA39835ADF064D05 /* libPods-AmpliSwiftSampleAppTests.a */; }; F8D20984CBA9F9E8B7274DBB /* libPods-AmpliSwiftSampleApp (macOS).a in Frameworks */ = {isa = PBXBuildFile; fileRef = D320B081553D038DE2C3451F /* libPods-AmpliSwiftSampleApp (macOS).a */; }; /* End PBXBuildFile section */ @@ -55,6 +56,7 @@ 4874785F85542D07984AFD54 /* Pods-AmpliSwiftSampleAppTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleAppTests.release.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleAppTests/Pods-AmpliSwiftSampleAppTests.release.xcconfig"; sourceTree = ""; }; 9DA67EDD533A140301A0ED6F /* libPods-AmpliSwiftSampleApp (iOS).a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AmpliSwiftSampleApp (iOS).a"; sourceTree = BUILT_PRODUCTS_DIR; }; AA54015EF375CC8893FEC6CC /* Pods-AmpliSwiftSampleApp (macOS).release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleApp (macOS).release.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleApp (macOS)/Pods-AmpliSwiftSampleApp (macOS).release.xcconfig"; sourceTree = ""; }; + BA4436A72A84CCE4002F1115 /* LoggingPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggingPlugin.swift; sourceTree = ""; }; D0BAADDDB89B39695FCD3EDF /* Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleApp (macOS)/Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig"; sourceTree = ""; }; D320B081553D038DE2C3451F /* libPods-AmpliSwiftSampleApp (macOS).a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AmpliSwiftSampleApp (macOS).a"; sourceTree = BUILT_PRODUCTS_DIR; }; FC778F7F39B4D2F8F3596B35 /* Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleApp (iOS)/Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig"; sourceTree = ""; }; @@ -112,6 +114,7 @@ 3ECE2C2A273F7B65004EAA2C /* Shared */ = { isa = PBXGroup; children = ( + BA4436A62A84CCC7002F1115 /* Plugins */, 3ECE2C502743332C004EAA2C /* Ampli */, 3ECE2C2D273F7B65004EAA2C /* AmpliSwiftSampleAppApp.swift */, 3E3B5FB127583BC9003D95E1 /* TextView.swift */, @@ -162,6 +165,14 @@ path = Pods; sourceTree = ""; }; + BA4436A62A84CCC7002F1115 /* Plugins */ = { + isa = PBXGroup; + children = ( + BA4436A72A84CCE4002F1115 /* LoggingPlugin.swift */, + ); + path = Plugins; + sourceTree = ""; + }; F0B610FBE681A3D6E6570E2C /* Frameworks */ = { isa = PBXGroup; children = ( @@ -183,7 +194,6 @@ 3E3B5FA2275803D3003D95E1 /* Sources */, 3E3B5FA3275803D3003D95E1 /* Frameworks */, 3E3B5FA4275803D3003D95E1 /* Resources */, - 37352C7584693F14DD5FEB62 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -203,7 +213,6 @@ 3ECE2C31273F7B6C004EAA2C /* Sources */, 3ECE2C32273F7B6C004EAA2C /* Frameworks */, 3ECE2C33273F7B6C004EAA2C /* Resources */, - 02C2383AF5D122603C7E0077 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -222,7 +231,6 @@ 3ECE2C37273F7B6C004EAA2C /* Sources */, 3ECE2C38273F7B6C004EAA2C /* Frameworks */, 3ECE2C39273F7B6C004EAA2C /* Resources */, - 90AFC11CB08FA6327F233DAE /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -302,40 +310,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 02C2383AF5D122603C7E0077 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleApp (iOS)/Pods-AmpliSwiftSampleApp (iOS)-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleApp (iOS)/Pods-AmpliSwiftSampleApp (iOS)-resources-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleApp (iOS)/Pods-AmpliSwiftSampleApp (iOS)-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 37352C7584693F14DD5FEB62 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleAppTests/Pods-AmpliSwiftSampleAppTests-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleAppTests/Pods-AmpliSwiftSampleAppTests-resources-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleAppTests/Pods-AmpliSwiftSampleAppTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 47870903BBE4154AF2CAF117 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -380,23 +354,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 90AFC11CB08FA6327F233DAE /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleApp (macOS)/Pods-AmpliSwiftSampleApp (macOS)-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleApp (macOS)/Pods-AmpliSwiftSampleApp (macOS)-resources-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AmpliSwiftSampleApp (macOS)/Pods-AmpliSwiftSampleApp (macOS)-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; D3903C8E82AE1D3F9503D24A /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -435,6 +392,7 @@ buildActionMask = 2147483647; files = ( 3ECE2C3E273F7B6C004EAA2C /* AmpliSwiftSampleApp.xcdatamodeld in Sources */, + BA4436A82A84CCE4002F1115 /* LoggingPlugin.swift in Sources */, 3ECE2C44273F7B6C004EAA2C /* Persistence.swift in Sources */, 3ECE2C532743332C004EAA2C /* Ampli.swift in Sources */, 3E3B5FB227583BC9003D95E1 /* TextView.swift in Sources */, diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift index f1d9aa24..cd30b823 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift @@ -1,32 +1,26 @@ -// -// AmpliTests.swift -// AmpliSwiftSampleAppTests -// -// Created by Qingzhuo Zhen on 12/1/21. -// - import XCTest import AmpliSwiftSampleApp -import Amplitude +import AmplitudeSwift let emptyDictionary = [String: String]() func isEmptyDictionary(_ dict: Any?) -> Bool { - return NSDictionary(dictionary: dict as! [String: String]).isEqual(to: emptyDictionary) + dict == nil || NSDictionary(dictionary: dict as! [String: String]).isEqual(to: emptyDictionary) } class AmpliTests: XCTestCase { - private var ampli: Ampli? - private var middlewareRun: XCTestExpectation? + private var ampli: Ampli! override func setUpWithError() throws { ampli = Ampli() - middlewareRun = expectation(description: "Waiting") } func initAmpliWithNewInstance(_ instanceName: String) { - let client = Amplitude.instance(withName: instanceName); - client.initializeApiKey("test-api-key"); - ampli?.load(LoadOptions(client: LoadClientOptions(instance: client))) + ampli.load(LoadOptions(client: LoadClientOptions(config: Configuration( + apiKey: "test-api-key", + instanceName: instanceName, + trackingSessionEvents: false, + migrateLegacyData: false + )))) } func testIdentify() throws { @@ -34,85 +28,70 @@ class AmpliTests: XCTestCase { let deviceId = "test-device-id"; initAmpliWithNewInstance("testIdentify") - + let eventCollector = EventCollectorPlugin() + ampli.client.add(plugin: eventCollector) + let identifyProperties = Identify(requiredNumber: 22.0, optionalArray: ["optional array str"]) let eventOptions = EventOptions(deviceId: deviceId) - - ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in - XCTAssertEqual(payload.event["event_type"] as! String, "$identify") - XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"])) - XCTAssertEqual(payload.event["user_id"] as! String, userId) - XCTAssertEqual(payload.event["device_id"] as! String, deviceId) - self.middlewareRun?.fulfill() - }) - ampli?.identify(userId, identifyProperties, options: eventOptions) - ampli?.flush() - - let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + + ampli.identify(userId, identifyProperties, options: eventOptions) + ampli.flush() + + XCTAssertEqual(eventCollector.events.count, 1) + let event = eventCollector.events[0] + XCTAssertEqual(event.eventType, "$identify") + XCTAssertTrue(isEmptyDictionary(event.eventProperties)) + XCTAssertEqual(event.userId, userId) + XCTAssertEqual(event.deviceId, deviceId) } func testIdentifyUserIdOnEvent() { initAmpliWithNewInstance("testIdentifyUserIdOnEvent") + let eventCollector = EventCollectorPlugin() + ampli.client.add(plugin: eventCollector) let eventOptionsUserId = "test-user-id-options" let deviceId = "test-device-id" let identifyProperties = Identify(requiredNumber: 22.0, optionalArray: ["optional array str"]) - let eventOptions = EventOptions(deviceId: deviceId, userId: eventOptionsUserId) - - ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in - XCTAssertEqual(payload.event["event_type"] as! String, "$identify") - XCTAssertEqual(payload.event["user_id"] as! String, eventOptionsUserId) - XCTAssertEqual(payload.event["device_id"] as! String, deviceId) - XCTAssertEqual(self.ampli?.client.userId, eventOptionsUserId) - self.middlewareRun?.fulfill() - }) - - ampli?.identify(nil, identifyProperties, options: eventOptions) - ampli?.flush() - - let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + let eventOptions = EventOptions(userId: eventOptionsUserId, deviceId: deviceId) + ampli.identify(nil, identifyProperties, options: eventOptions) + ampli.flush() + + XCTAssertEqual(eventCollector.events.count, 1) + let event = eventCollector.events[0] + XCTAssertEqual(event.eventType, "$identify") + XCTAssertEqual(event.userId, eventOptionsUserId) + XCTAssertEqual(event.deviceId, deviceId) + XCTAssertEqual(ampli.client.getUserId(), eventOptionsUserId) } func testTrackWithNoProperties() throws { initAmpliWithNewInstance("testTrackWithNoProperties") - - ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in - XCTAssertEqual(payload.event["event_type"] as! String, "Event No Properties") - XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"])) -// XCTAssertNil(payload.event["user_id"]) -// XCTAssertNotNil(payload.event["device_id"]) - self.middlewareRun?.fulfill() - }) - ampli?.eventNoProperties() - ampli?.flush() - - let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + let eventCollector = EventCollectorPlugin() + ampli.client.add(plugin: eventCollector) + + ampli.eventNoProperties() + ampli.flush() + + XCTAssertEqual(eventCollector.events.count, 1) + let event = eventCollector.events[0] + XCTAssertEqual(event.eventType, "Event No Properties") + XCTAssertTrue(isEmptyDictionary(event.eventProperties)) + XCTAssertNil(event.userId) + XCTAssertNotNil(event.deviceId) } func testTrackEventWithAllTypes() throws { let userId = "test-user-id"; let deviceId = "test-device-id"; let eventOptions = EventOptions(deviceId: deviceId) - let extraDict: MiddlewareExtra = ["test" : "extra test"]; - + initAmpliWithNewInstance("testTrackEventWithAllTypes") - - ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in - XCTAssertEqual(payload.event["event_type"] as! String, "Event With All Properties") - let eventProperties = payload.event["event_properties"] as? Dictionary - XCTAssertEqual(eventProperties!["requiredArray"] as! Array, ["array element 1", "array element 2"]) - XCTAssertEqual(eventProperties!["requiredBoolean"] as! Bool, true) - XCTAssertEqual(eventProperties!["requiredEnum"] as! String, "Enum1") - XCTAssertEqual(eventProperties!["requiredInteger"] as! Int, 10) - XCTAssertEqual(eventProperties!["requiredNumber"] as! Double, 2.0) - XCTAssertEqual(eventProperties!["requiredString"] as! String, "required string") - XCTAssertNil(eventProperties!["optionalString"]) - XCTAssertEqual(payload.event["user_id"] as! String, userId) - XCTAssertEqual(payload.event["device_id"] as! String, deviceId) - self.middlewareRun?.fulfill() - }) - ampli?.track( + let eventCollector = EventCollectorPlugin() + ampli.client.add(plugin: eventCollector) + + ampli.track( EventWithAllProperties( requiredArray: ["array element 1", "array element 2"], requiredBoolean: true, @@ -121,60 +100,72 @@ class AmpliTests: XCTestCase { requiredNumber: 2.0, requiredString: "required string" ).options(userId: userId), - options: eventOptions, - extra: extraDict + options: eventOptions ) - ampli?.flush() - - let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + ampli.flush() + + XCTAssertEqual(eventCollector.events.count, 1) + let event = eventCollector.events[0] + XCTAssertEqual(event.eventType, "Event With All Properties") + let eventProperties = event.eventProperties + XCTAssertNotNil(event.eventProperties) + XCTAssertEqual(eventProperties!["requiredArray"] as! Array, ["array element 1", "array element 2"]) + XCTAssertEqual(eventProperties!["requiredBoolean"] as! Bool, true) + XCTAssertEqual(eventProperties!["requiredEnum"] as! String, "Enum1") + XCTAssertEqual(eventProperties!["requiredInteger"] as! Int, 10) + XCTAssertEqual(eventProperties!["requiredNumber"] as! Double, 2.0) + XCTAssertEqual(eventProperties!["requiredString"] as! String, "required string") + XCTAssertNil(eventProperties!["optionalString"]) + XCTAssertEqual(event.userId, userId) + XCTAssertEqual(event.deviceId, deviceId) } func testSetGroup() throws { let groupType = "test-group-type"; let groupName = "test-group"; - + initAmpliWithNewInstance("testSetGroup") - - ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in - XCTAssertEqual(payload.event["event_type"] as! String, "$identify") - XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"])) - let userProperties = payload.event["user_properties"] as? Dictionary - let userPropertiesSet = userProperties!["$set"] as? Dictionary - XCTAssertEqual(userPropertiesSet![groupType] as! String, groupName) - self.middlewareRun?.fulfill() - }) - ampli?.client.setGroup(groupType, groupName: groupName as NSObject) - ampli?.flush() - - let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + let eventCollector = EventCollectorPlugin() + ampli.client.add(plugin: eventCollector) + + ampli.client.setGroup(groupType: groupType, groupName: groupName) + ampli.flush() + + XCTAssertEqual(eventCollector.events.count, 1) + let event = eventCollector.events[0] + XCTAssertEqual(event.eventType, "$identify") + XCTAssertTrue(isEmptyDictionary(event.eventProperties)) + // TODO: uncomment after Amplitude-Swift update. + // let userProperties = event.userProperties + // let userPropertiesSet = userProperties!["$set"] as? Dictionary + // XCTAssertEqual(userPropertiesSet![groupType] as! String, groupName) } func testGroupIdentify() throws { let groupType = "test-group-type"; let groupName = "test-group"; - + initAmpliWithNewInstance("testGroupIdentify") - - ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in - XCTAssertEqual(payload.event["event_type"] as! String, "$groupidentify") - XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"])) - XCTAssertTrue(isEmptyDictionary(payload.event["user_properties"])) - let groups = payload.event["groups"] as? Dictionary - XCTAssertEqual(groups![groupType] as! String, groupName) - let groupProperties = payload.event["group_properties"] as? Dictionary - let groupPropertiesSet = groupProperties!["$set"] as? Dictionary - XCTAssertEqual(groupPropertiesSet!["requiredBoolean"] as! Bool, false) - XCTAssertEqual(groupPropertiesSet!["optionalString"] as! String, "optional str") - self.middlewareRun?.fulfill() - }) - - let identifyArgs = AMPIdentify() - identifyArgs.set("requiredBoolean", value: false as NSObject) - identifyArgs.set("optionalString", value: "optional str" as NSObject) - ampli?.client.groupIdentify(withGroupType: groupType, groupName: groupName as NSObject, groupIdentify: identifyArgs) - ampli?.flush() - - let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + let eventCollector = EventCollectorPlugin() + ampli.client.add(plugin: eventCollector) + + let groupProperties: [String:Any] = [ + "requiredBoolean": false, + "optionalString": "optional str" + ] + ampli.client.groupIdentify(groupType: groupType, groupName: groupName, groupProperties: groupProperties) + ampli.flush() + + XCTAssertEqual(eventCollector.events.count, 1) + let event = eventCollector.events[0] + XCTAssertEqual(event.eventType, "$groupidentify") + XCTAssertTrue(isEmptyDictionary(event.eventProperties)) + XCTAssertTrue(isEmptyDictionary(event.userProperties)) + let groups = event.groups + XCTAssertEqual(groups![groupType] as! String, groupName) + let groupPropertiesSet = event.groupProperties!["$set"] as? Dictionary + XCTAssertEqual(groupPropertiesSet!["requiredBoolean"] as! Bool, false) + XCTAssertEqual(groupPropertiesSet!["optionalString"] as! String, "optional str") } func testGroupIdentifyNilOptionalString() throws { @@ -182,26 +173,44 @@ class AmpliTests: XCTestCase { let groupName = "test-group"; initAmpliWithNewInstance("testGroupIdentifyNilOptionalString") - - ampli?.client.addEventMiddleware(AMPBlockMiddleware { (payload, next) in - XCTAssertEqual(payload.event["event_type"] as! String, "$groupidentify") - XCTAssertTrue(isEmptyDictionary(payload.event["event_properties"])) - XCTAssertTrue(isEmptyDictionary(payload.event["user_properties"])) - let groups = payload.event["groups"] as? Dictionary - XCTAssertEqual(groups![groupType] as! String, groupName) - let groupProperties = payload.event["group_properties"] as? Dictionary - let groupPropertiesSet = groupProperties!["$set"] as? Dictionary - XCTAssertEqual(groupPropertiesSet!["requiredBoolean"] as! Bool, false) - XCTAssertNil(groupPropertiesSet!["optionalString"]) - self.middlewareRun?.fulfill() - }) - - let identifyArgs = AMPIdentify() - identifyArgs.set("requiredBoolean", value: false as NSObject) - identifyArgs.set("optionalString", value: nil) - ampli?.client.groupIdentify(withGroupType: groupType, groupName: groupName as NSObject, groupIdentify: identifyArgs) - ampli?.flush() - - let _ = XCTWaiter.wait(for: [middlewareRun!], timeout: 2.0) + let eventCollector = EventCollectorPlugin() + ampli.client.add(plugin: eventCollector) + + let identify = Identify() + identify.set(property: "requiredBoolean", value: false) + identify.set(property: "optionalString", value: nil) + ampli.client.groupIdentify(groupType: groupType, groupName: groupName, identify: identify) + ampli.flush() + + + XCTAssertEqual(eventCollector.events.count, 1) + let event = eventCollector.events[0] + XCTAssertEqual(event.eventType, "$groupidentify") + XCTAssertTrue(isEmptyDictionary(event.eventProperties)) + XCTAssertTrue(isEmptyDictionary(event.userProperties)) + let groups = event.groups + XCTAssertEqual(groups![groupType] as! String, groupName) + let groupPropertiesSet = event.groupProperties!["$set"] as? Dictionary + XCTAssertEqual(groupPropertiesSet!["requiredBoolean"] as! Bool, false) + XCTAssertNil(groupPropertiesSet!["optionalString"]) + } +} + +class EventCollectorPlugin: Plugin { + var type: PluginType + var amplitude: Amplitude? + var events: [BaseEvent] = Array() + + init() { + self.type = .destination + } + + func setup(amplitude: Amplitude) { + self.amplitude = amplitude + } + + func execute(event: BaseEvent?) -> BaseEvent? { + events.append(event!) + return event } } diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Podfile b/ios/swift/v2/AmpliSwiftSampleApp/Podfile index 42a91f1b..1aa723c9 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Podfile +++ b/ios/swift/v2/AmpliSwiftSampleApp/Podfile @@ -1,6 +1,6 @@ def import_pods -pod 'Amplitude', "~> 8.13.0" +pod 'AmplitudeSwift', "~> 0.4.8" end diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift index 221f005c..02c631ec 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift @@ -2,22 +2,20 @@ * Ampli - A strong typed wrapper for your Analytics * * This file is generated by Amplitude. - * To update run 'ampli pull swift-ampli' + * To update run 'ampli pull swift-ampli-v2' * - * Required dependencies: Amplitude ~> 8.10 + * Required dependencies: https://github.com/amplitude/Amplitude-Swift ~> 1.0 * Tracking Plan Version: 1 * Build: 1.0.0 - * Runtime: ios:swift-ampli + * Runtime: ios:swift-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/swift-ampli) + * [Full Setup Instructions](https://data.amplitude.com/test-codegen/Test%20Codegen/implementation/swift-ampli-v2) */ import Foundation -import Amplitude - -public typealias MiddlewareExtra = [String: Any] +import AmplitudeSwift public enum AmpliEnvironment: Int { case prod, dev @@ -28,11 +26,12 @@ let ApiKey: [AmpliEnvironment: String] = [ .dev: "" ] -let AmpliObservePlan = AMPPlan() - .setBranch("main") - .setSource("swift-ampli") - .setVersion("1") - .setVersionId("a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c") +let AmpliObservePlan = Plan( + branch: "main", + source: "swift-ampli-v2", + version: "1", + versionId: "a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c" +) public class Event { public let eventType: String @@ -59,7 +58,7 @@ public class GenericEvent : Event { } public func options(deviceId: String? = nil, userId: String? = nil) -> E { - return self.options(EventOptions(deviceId: deviceId, userId: userId)) + return self.options(EventOptions(userId: userId, deviceId: deviceId)) } } @@ -505,21 +504,13 @@ public class EventMaxIntForTest : GenericEvent { } } -public struct LoadClientConfig { - public let plan: AMPPlan? - - public init(plan: AMPPlan? = nil) { - self.plan = plan - } -} - public struct LoadClientOptions { public let apiKey: String? public let instance: Amplitude? - public let config: LoadClientConfig? + public let config: Configuration? - public init(apiKey: String? = nil, instance: Amplitude? = nil, config: LoadClientConfig? = nil) { - self.apiKey = apiKey + public init(apiKey: String? = nil, instance: Amplitude? = nil, config: Configuration? = nil) { + self.apiKey = apiKey ?? config?.apiKey self.instance = instance self.config = config } @@ -537,16 +528,6 @@ public struct LoadOptions { } } -public struct EventOptions { - public let deviceId: String? - public let userId: String? - - public init(deviceId: String? = nil, userId: String? = nil) { - self.deviceId = deviceId - self.userId = userId - } -} - public class Ampli { private var amplitude: Amplitude? public var client: Amplitude { @@ -581,71 +562,61 @@ public class Ampli { // options should have 'environment', 'client.api_key' or 'client.instance' public func load(_ options: LoadOptions) -> Void { self.disabled = options.disabled ?? false - if (self.isLoaded) { + if self.isLoaded { NSLog("Warning: Ampli is already initialized. Ampli.instance.load() should be called once at application start up.") return } var apiKey: String? - if (options.client?.apiKey != nil) { - apiKey = options.client?.apiKey - } else if (options.environment != nil) { - apiKey = ApiKey[options.environment!] + if let clientApiKey = options.client?.apiKey { + apiKey = clientApiKey + } else if let environment = options.environment { + apiKey = ApiKey[environment] } - if (options.client?.instance != nil) { - self.amplitude = options.client?.instance - } else if (apiKey != nil) { - self.amplitude = Amplitude.instance() - self.amplitude?.initializeApiKey(apiKey!) + if let instance = options.client?.instance { + self.amplitude = instance + } else if let apiKey = apiKey { + let configuration = options.client?.config ?? Configuration( + apiKey: apiKey + ) + if configuration.plan == nil { + configuration.plan = AmpliObservePlan + } + if configuration.ingestionMetadata == nil { + configuration.ingestionMetadata = IngestionMetadata( + sourceName: "ios-swift-ampli-v2", sourceVersion: "1.0.0" + ) + } + self.amplitude = Amplitude(configuration: configuration) } else { NSLog("ampli.load() requires 'environment', 'client.apiKey', or 'client.instance'") return } - - self.amplitude?.setPlan(options.client?.config?.plan ?? AmpliObservePlan!) - - // set ingestionMetadata information - let AmpliExtrasMiddleware = AMPBlockMiddleware { (payload, next) in - let ingestionMetadata: NSMutableDictionary = [ - "source_name": "ios-swift-ampli", - "source_version": "1.0.0" - ] - payload.event["ingestion_metadata"] = ingestionMetadata - // Continue to next middleware - next(payload) - } - self.amplitude?.addEventMiddleware(AmpliExtrasMiddleware) } - public func track(_ event: Event, options: EventOptions? = nil, extra: MiddlewareExtra? = nil) -> Void { - if (!isInitializedAndEnabled()) { + public func track(_ event: Event, options: EventOptions? = nil) -> Void { + if !isInitializedAndEnabled() { return } - self.handleEventOptions(event.options, options) - amplitude?.logEvent(event.eventType, withEventProperties: event.eventProperties, withMiddlewareExtra: extra as? NSMutableDictionary) + let eventOptions = getEventOptions(event.options, options) + amplitude?.track(eventType: event.eventType, eventProperties: event.eventProperties, options: eventOptions) } - public func identify(_ userId: String?, _ event: Identify, options: EventOptions? = nil, extra: MiddlewareExtra? = nil) -> Void { - if (!isInitializedAndEnabled()) { + public func identify(_ userId: String?, _ event: Identify, options: EventOptions? = nil) -> Void { + if !isInitializedAndEnabled() { return } - self.handleEventOptions(event.options, options, userId) - - let identifyArgs = AMPIdentify() - event.eventProperties?.forEach{ key, value in - identifyArgs.set(key, value: value as? NSObject) - } - - amplitude?.identify(identifyArgs) + let eventOptions = getEventOptions(event.options, options, userId) + amplitude?.identify(userProperties: event.eventProperties, options: eventOptions) } public func flush() -> Void { - if (!isInitializedAndEnabled()) { + if !isInitializedAndEnabled() { return } - amplitude?.uploadEvents() + amplitude?.flush() } /** @@ -935,15 +906,17 @@ public class Ampli { )) } - private func handleEventOptions(_ options: EventOptions?, _ overrideOptions: EventOptions?, _ overrideUserId: String? = nil) { - let userId = overrideUserId ?? overrideOptions?.userId ?? options?.userId - if (userId != nil) { - amplitude?.setUserId(userId) + private func getEventOptions(_ options: EventOptions?, _ overrideOptions: EventOptions?, _ overrideUserId: String? = nil) -> EventOptions { + let dummyEvent = BaseEvent(eventType: "dummy") + if let options = options { + dummyEvent.mergeEventOptions(eventOptions: options) } - - let deviceId = overrideOptions?.deviceId ?? options?.deviceId - if (deviceId != nil) { - amplitude?.setDeviceId(deviceId!) + if let overrideOptions = overrideOptions { + dummyEvent.mergeEventOptions(eventOptions: overrideOptions) + } + if let overrideUserId = overrideUserId { + dummyEvent.userId = overrideUserId } + return dummyEvent } } diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift index 0c14d3e1..6f0414b1 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift @@ -6,7 +6,7 @@ // import SwiftUI -import Amplitude +import AmplitudeSwift @main struct AmpliSwiftSampleAppApp: App { @@ -19,50 +19,40 @@ struct AmpliSwiftSampleAppApp: App { // This requires connecting your account via `ampli pull` which will set you API key in the generated Ampli SDK // // OR Specify a AmpliEnvironment - // ampli.load(LoadOptions(environment: AmpliEnvironment.development) + // ampli.load(LoadOptions(environment: AmpliEnvironment.dev)) // // OR Provide a specific Amplitude API key - // ampli.load(LoadOptions(client: LoadClientOptions(apiKey: "Custom api key")) + // ampli.load(LoadOptions(client: LoadClientOptions(apiKey: "Custom api key"))) // // OR Use an existing Amplitude instance - // requires "import Amplitude" - // let instance = Amplitude.instance("instanceName"); - // instance.initializeApiKey("Custom api key"); + // requires "import AmplitudeSwift" + // let instance = Amplitude(configuration: Configuration(apiKey: "Custom api key", instanceName: "instanceName")) // ampli.load(LoadOptions(client: LoadClientOptions(instance: instance))) // // For testing you can disable ampli - // ampli.load(LoadOptions(disabled: ENV.IS_TESTING ? true: false)) + // ampli.load(LoadOptions(disabled: ProcessInfo.processInfo.environment["IS_TESTING"] == "true" ? true: false)) // // Make as many Ampli instances as you want - // let ampli2 = new Ampli(); + // let ampli2 = Ampli() // ampli2.load(LoadOptions(client: LoadClientOptions(apiKey: "api-key-2"))) - let apiKey = ProcessInfo.processInfo.environment["AMPLITUDE_API_KEY"] ?? "test-api-key"; + let apiKey = ProcessInfo.processInfo.environment["AMPLITUDE_API_KEY"] ?? "test-api-key" let ampli = Ampli.instance - let extraDict = ["test" : "extra test"]; // Load ampli.load(LoadOptions(client: LoadClientOptions(apiKey: apiKey))) - - // Add Middleware - let loggingMiddleware = AMPBlockMiddleware { (payload, next) in - // Output event and extra from payload - print(String(format:"[ampli] event=\(payload.event) payload=\(String(describing: payload.extra))")) - // Continue to next middleware - next(payload); - } - ampli.client.addEventMiddleware(loggingMiddleware) + + ampli.client.add(plugin: LoggingPlugin()) // Identify ampli.identify("ampli-swift-user", Identify(requiredNumber: 22.0, optionalArray: ["optional string"])) // Set group - ampli.client.setGroup("ampli group type", groupName: "ampli swift group" as NSObject) + ampli.client.setGroup(groupType: "ampli group type", groupName: "ampli swift group") // GroupIdentify - let identifyArgs = AMPIdentify() - identifyArgs.set("requiredBoolean", value: true as NSObject) - ampli.client.groupIdentify(withGroupType: "ampli group type", groupName: "ampli swift group" as NSObject, groupIdentify: identifyArgs) + let groupProperties = ["requiredBoolean": true] + ampli.client.groupIdentify(groupType: "ampli group type", groupName: "ampli swift group", groupProperties: groupProperties) // Track events with dedicated event methods ampli.eventNoProperties() @@ -79,7 +69,7 @@ struct AmpliSwiftSampleAppApp: App { requiredString: "required string", optionalString: nil ) - ampli.track(eventWithAllProperties, extra: extraDict) + ampli.track(eventWithAllProperties) ampli.eventObjectTypes( requiredObject: 3, @@ -115,7 +105,7 @@ struct AmpliSwiftSampleAppApp: App { optionalEventProperty: 1.23 ) - ampli.client.uploadEvents(); + ampli.flush() return WindowGroup { ContentView() diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Plugins/LoggingPlugin.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Plugins/LoggingPlugin.swift new file mode 100644 index 00000000..fa0444d8 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Plugins/LoggingPlugin.swift @@ -0,0 +1,25 @@ +import Foundation +import AmplitudeSwift + +class LoggingPlugin: Plugin { + let type: PluginType + var amplitude: Amplitude? + let jsonEncoder: JSONEncoder + + init() { + self.type = .before + self.jsonEncoder = JSONEncoder() + self.jsonEncoder.outputFormatting = [.prettyPrinted] + } + + func setup(amplitude: Amplitude) { + self.amplitude = amplitude + } + + func execute(event: BaseEvent?) -> BaseEvent? { + let jsonData = try? jsonEncoder.encode(event) + let json = jsonData != nil ? String(data: jsonData!, encoding: String.Encoding.utf8) : "" + print(String(format:"[ampli] event=\(json ?? "")")) + return event + } +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/ampli.json b/ios/swift/v2/AmpliSwiftSampleApp/ampli.json index b2c22d5e..48e94e08 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/ampli.json +++ b/ios/swift/v2/AmpliSwiftSampleApp/ampli.json @@ -1,14 +1,14 @@ { "OrgId": "132559", "WorkspaceId": "77b37977-cb3a-42eb-bce3-09f5f7c3adb7", - "SourceId": "2c9d4579-657b-4eac-a989-cdb3e3daf39f", + "SourceId": "ff1de76c-80bb-42ea-8d39-63402f588c7f", "Path": "./Shared/Ampli", "Branch": "main", "Version": "1.0.0", - "Runtime": "ios:swift-ampli", + "Runtime": "ios:swift-ampli-v2", "VersionId": "a61c3908-ca4d-4c8d-8f81-54ad3ba17b9c", "OmitApiKeys": true, "Platform": "iOS", "Language": "Swift", - "SDK": "Amplitude ~> 8.8.0" + "SDK": "Amplitude-Swift ~> 1.0" } \ No newline at end of file From 556b75a89f38de2c75ef782f72646c5916eb7070 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Thu, 10 Aug 2023 13:26:25 +0400 Subject: [PATCH 11/21] AMP-63100 Swift v2 app: CI tests --- ...-ios-test.yml => ci-build-ios-v1-test.yml} | 12 ++--- .github/workflows/ci-build-ios-v2-test.yml | 54 +++++++++++++++++++ ios/swift/v2/AmpliSwiftSampleApp/README.md | 4 +- 3 files changed, 62 insertions(+), 8 deletions(-) rename .github/workflows/{ci-build-ios-test.yml => ci-build-ios-v1-test.yml} (89%) create mode 100644 .github/workflows/ci-build-ios-v2-test.yml diff --git a/.github/workflows/ci-build-ios-test.yml b/.github/workflows/ci-build-ios-v1-test.yml similarity index 89% rename from .github/workflows/ci-build-ios-test.yml rename to .github/workflows/ci-build-ios-v1-test.yml index 024f73f5..8e22aa6a 100644 --- a/.github/workflows/ci-build-ios-test.yml +++ b/.github/workflows/ci-build-ios-v1-test.yml @@ -1,10 +1,10 @@ -name: CI - iOS Tests +name: CI - iOS V1 Tests on: pull_request: paths: - 'ios/objective-c/**' - - 'ios/swift/**' + - 'ios/swift/v1/**' jobs: test: @@ -31,12 +31,12 @@ jobs: uses: actions/cache@v2 with: path: | - ./ios/swift/AmpliSwiftSampleApp/Pods - ./ios/swift/AmpliSwiftSampleApp/vendor/bundle + ./ios/swift/v1/AmpliSwiftSampleApp/Pods + ./ios/swift/v1/AmpliSwiftSampleApp/vendor/bundle key: ${{ runner.os }}-ruby-${{ matrix.ruby-version }}-gems-${{ hashFiles('**/Gemfile.lock') }}-pods-${{ hashFiles('**/Podfile.lock') }} - name: Install Cocoapods For Swift - working-directory: ./ios/swift/AmpliSwiftSampleApp + working-directory: ./ios/swift/v1/AmpliSwiftSampleApp if: steps.cache-gems-pods.outputs.cache-hit != 'true' run: | gem install bundler @@ -45,7 +45,7 @@ jobs: pod install - name: Swfit iOS Tests - working-directory: ./ios/swift/AmpliSwiftSampleApp + working-directory: ./ios/swift/v1/AmpliSwiftSampleApp run: | pod install xcodebuild test \ diff --git a/.github/workflows/ci-build-ios-v2-test.yml b/.github/workflows/ci-build-ios-v2-test.yml new file mode 100644 index 00000000..cc38c677 --- /dev/null +++ b/.github/workflows/ci-build-ios-v2-test.yml @@ -0,0 +1,54 @@ +name: CI - iOS V2 Tests + +on: + pull_request: + paths: + - 'ios/swift/v2/**' + +jobs: + test: + name: Test + runs-on: macos-12 + strategy: + matrix: + ruby-version: ["2.7.x"] + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Set Xcode 14.2 + run: | + sudo xcode-select -switch /Applications/Xcode_14.2.app + + - name: Setup Ruby + uses: actions/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + + - name: Cache Bundle Gems and Cocoapods For Swift + id: cache-gems-pods + uses: actions/cache@v2 + with: + path: | + ./ios/swift/v2/AmpliSwiftSampleApp/Pods + ./ios/swift/v2/AmpliSwiftSampleApp/vendor/bundle + key: ${{ runner.os }}-ruby-${{ matrix.ruby-version }}-gems-${{ hashFiles('**/Gemfile.lock') }}-pods-${{ hashFiles('**/Podfile.lock') }} + + - name: Install Cocoapods For Swift + working-directory: ./ios/swift/v2/AmpliSwiftSampleApp + if: steps.cache-gems-pods.outputs.cache-hit != 'true' + run: | + gem install bundler + bundle config path vendor/bundle + bundle install + pod install + + - name: Swfit iOS Tests + working-directory: ./ios/swift/v2/AmpliSwiftSampleApp + run: | + pod install + xcodebuild test \ + -workspace AmpliSwiftSampleApp.xcworkspace \ + -scheme AmpliSwiftSampleAppTests \ + -sdk iphonesimulator \ + -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.2' diff --git a/ios/swift/v2/AmpliSwiftSampleApp/README.md b/ios/swift/v2/AmpliSwiftSampleApp/README.md index 9497f8cf..0841cc11 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/README.md +++ b/ios/swift/v2/AmpliSwiftSampleApp/README.md @@ -1,5 +1,5 @@ -# Ampli iOS SDK (Swift) -An example app using the Ampli Swift SDK +# Ampli iOS SDK 2.0 (Swift) +An example app using the Ampli Swift SDK V2. # Usage From 8bbb2352abf986bede4d75682d6fff9b39213fda Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Thu, 10 Aug 2023 13:28:59 +0400 Subject: [PATCH 12/21] AMP-63100 Swift v2 app: update CI merge check --- .github/workflows/ampli-merge-check.ios.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ampli-merge-check.ios.yml b/.github/workflows/ampli-merge-check.ios.yml index 1b6b965e..ce1834c2 100644 --- a/.github/workflows/ampli-merge-check.ios.yml +++ b/.github/workflows/ampli-merge-check.ios.yml @@ -19,8 +19,12 @@ jobs: - name: Checkout repo uses: actions/checkout@v2 - - name: (iOS Swift) Check the Data branch is merged before merging the Git branch - working-directory: ./ios/swift/AmpliSwiftSampleApp + - name: (iOS Swift V1) Check the Data branch is merged before merging the Git branch + working-directory: ./ios/swift/v1/AmpliSwiftSampleApp + run: ampli status --is-merged -t ${{secrets.AMPLI_TOKEN}} + + - name: (iOS Swift V2) Check the Data branch is merged before merging the Git branch + 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 From 21eaf4ccd11aad047ccf1d8f50a67e2d5f679c3b Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Thu, 10 Aug 2023 13:53:41 +0400 Subject: [PATCH 13/21] AMP-63100 Swift v2 app: update Ampli.swift --- ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift index 02c631ec..e5a9644c 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift @@ -510,7 +510,7 @@ public struct LoadClientOptions { public let config: Configuration? public init(apiKey: String? = nil, instance: Amplitude? = nil, config: Configuration? = nil) { - self.apiKey = apiKey ?? config?.apiKey + self.apiKey = apiKey self.instance = instance self.config = config } @@ -571,6 +571,8 @@ public class Ampli { if let clientApiKey = options.client?.apiKey { apiKey = clientApiKey + else if let configApiKey = options.client?.config?.apiKey { + apiKey = configApiKey } else if let environment = options.environment { apiKey = ApiKey[environment] } From db922e5d57b851e726a90e99eef40f0a25240fb7 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Thu, 10 Aug 2023 13:59:45 +0400 Subject: [PATCH 14/21] AMP-63100 Swift v2 app: update Ampli.swift --- ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift index e5a9644c..40d97d5d 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift @@ -571,7 +571,7 @@ public class Ampli { if let clientApiKey = options.client?.apiKey { apiKey = clientApiKey - else if let configApiKey = options.client?.config?.apiKey { + } else if let configApiKey = options.client?.config?.apiKey { apiKey = configApiKey } else if let environment = options.environment { apiKey = ApiKey[environment] From adfc564e216926bc531a4d3dd004c926caed45f2 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Fri, 11 Aug 2023 10:35:43 +0400 Subject: [PATCH 15/21] AMP-63100 Swift v2 app: update to AmplitudeSwift 0.4.9 --- .../AmpliSwiftSampleAppTests/AmpliTests.swift | 7 +++---- ios/swift/v2/AmpliSwiftSampleApp/Podfile | 2 +- .../Shared/AmpliSwiftSampleAppApp.swift | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift index cd30b823..14c46cff 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift @@ -135,10 +135,9 @@ class AmpliTests: XCTestCase { let event = eventCollector.events[0] XCTAssertEqual(event.eventType, "$identify") XCTAssertTrue(isEmptyDictionary(event.eventProperties)) - // TODO: uncomment after Amplitude-Swift update. - // let userProperties = event.userProperties - // let userPropertiesSet = userProperties!["$set"] as? Dictionary - // XCTAssertEqual(userPropertiesSet![groupType] as! String, groupName) + let userProperties = event.userProperties + let userPropertiesSet = userProperties!["$set"] as? Dictionary + XCTAssertEqual(userPropertiesSet![groupType] as! String, groupName) } func testGroupIdentify() throws { diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Podfile b/ios/swift/v2/AmpliSwiftSampleApp/Podfile index 1aa723c9..96ee168d 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Podfile +++ b/ios/swift/v2/AmpliSwiftSampleApp/Podfile @@ -1,6 +1,6 @@ def import_pods -pod 'AmplitudeSwift', "~> 0.4.8" +pod 'AmplitudeSwift', "~> 0.4.9" end diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift index 6f0414b1..64cd7520 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift @@ -41,7 +41,7 @@ struct AmpliSwiftSampleAppApp: App { // Load ampli.load(LoadOptions(client: LoadClientOptions(apiKey: apiKey))) - + ampli.client.add(plugin: LoggingPlugin()) // Identify From 451e5067d6b76c640c090c3d86d52ae6ef170507 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Mon, 14 Aug 2023 15:05:12 +0400 Subject: [PATCH 16/21] AMP-63100 Swift v2 app: update to AmplitudeSwift 0.4.11 --- ios/swift/v2/AmpliSwiftSampleApp/Podfile | 2 +- .../v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Podfile b/ios/swift/v2/AmpliSwiftSampleApp/Podfile index 96ee168d..2b21dc21 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Podfile +++ b/ios/swift/v2/AmpliSwiftSampleApp/Podfile @@ -1,6 +1,6 @@ def import_pods -pod 'AmplitudeSwift', "~> 0.4.9" +pod 'AmplitudeSwift', "~> 0.4.11" end diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift index 40d97d5d..adb69645 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift @@ -909,16 +909,16 @@ public class Ampli { } private func getEventOptions(_ options: EventOptions?, _ overrideOptions: EventOptions?, _ overrideUserId: String? = nil) -> EventOptions { - let dummyEvent = BaseEvent(eventType: "dummy") + let eventOptions = EventOptions() if let options = options { - dummyEvent.mergeEventOptions(eventOptions: options) + eventOptions.mergeEventOptions(eventOptions: options) } if let overrideOptions = overrideOptions { - dummyEvent.mergeEventOptions(eventOptions: overrideOptions) + eventOptions.mergeEventOptions(eventOptions: overrideOptions) } if let overrideUserId = overrideUserId { - dummyEvent.userId = overrideUserId + eventOptions.userId = overrideUserId } - return dummyEvent + return eventOptions } } From 978f8f2a95b804c811e84f72de6b30cf570864c8 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Thu, 17 Aug 2023 10:02:54 +0400 Subject: [PATCH 17/21] AMP-63100 Swift v2 app: update to AmplitudeSwift 0.4.14 --- .../AmpliSwiftSampleAppTests/AmpliTests.swift | 18 ++++-------------- ios/swift/v2/AmpliSwiftSampleApp/Podfile | 2 +- .../Shared/AmpliSwiftSampleAppApp.swift | 4 ++-- .../Shared/Plugins/LoggingPlugin.swift | 13 +++---------- 4 files changed, 10 insertions(+), 27 deletions(-) diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift index 14c46cff..c282825b 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift @@ -115,7 +115,7 @@ class AmpliTests: XCTestCase { XCTAssertEqual(eventProperties!["requiredInteger"] as! Int, 10) XCTAssertEqual(eventProperties!["requiredNumber"] as! Double, 2.0) XCTAssertEqual(eventProperties!["requiredString"] as! String, "required string") - XCTAssertNil(eventProperties!["optionalString"]) + XCTAssertFalse(eventProperties!.keys.contains("optionalString")) XCTAssertEqual(event.userId, userId) XCTAssertEqual(event.deviceId, deviceId) } @@ -195,21 +195,11 @@ class AmpliTests: XCTestCase { } } -class EventCollectorPlugin: Plugin { - var type: PluginType - var amplitude: Amplitude? +class EventCollectorPlugin: DestinationPlugin { var events: [BaseEvent] = Array() - init() { - self.type = .destination - } - - func setup(amplitude: Amplitude) { - self.amplitude = amplitude - } - - func execute(event: BaseEvent?) -> BaseEvent? { - events.append(event!) + override func execute(event: BaseEvent) -> BaseEvent? { + events.append(event) return event } } diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Podfile b/ios/swift/v2/AmpliSwiftSampleApp/Podfile index 2b21dc21..79e29314 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Podfile +++ b/ios/swift/v2/AmpliSwiftSampleApp/Podfile @@ -1,6 +1,6 @@ def import_pods -pod 'AmplitudeSwift', "~> 0.4.11" +pod 'AmplitudeSwift', "~> 0.4.14" end diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift index 64cd7520..06bb9eb7 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/AmpliSwiftSampleAppApp.swift @@ -72,8 +72,8 @@ struct AmpliSwiftSampleAppApp: App { ampli.track(eventWithAllProperties) ampli.eventObjectTypes( - requiredObject: 3, - requiredObjectArray: [1, true, "string"] + requiredObject: ["prop1": 3, "prop2": "abc"], + requiredObjectArray: [1, true, "string", ["prop1": 23, "prop2": "xyz"]] ) ampli.eventWithEnumTypes( diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Plugins/LoggingPlugin.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Plugins/LoggingPlugin.swift index fa0444d8..de01c4b2 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Plugins/LoggingPlugin.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Plugins/LoggingPlugin.swift @@ -1,22 +1,15 @@ import Foundation import AmplitudeSwift -class LoggingPlugin: Plugin { - let type: PluginType - var amplitude: Amplitude? +class LoggingPlugin: BeforePlugin { let jsonEncoder: JSONEncoder - init() { - self.type = .before + override init() { self.jsonEncoder = JSONEncoder() self.jsonEncoder.outputFormatting = [.prettyPrinted] } - func setup(amplitude: Amplitude) { - self.amplitude = amplitude - } - - func execute(event: BaseEvent?) -> BaseEvent? { + public override func execute(event: BaseEvent) -> BaseEvent? { let jsonData = try? jsonEncoder.encode(event) let json = jsonData != nil ? String(data: jsonData!, encoding: String.Encoding.utf8) : "" print(String(format:"[ampli] event=\(json ?? "")")) From e9370ea16191350d85709af2d8015bc20c06d845 Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Thu, 17 Aug 2023 10:53:01 +0400 Subject: [PATCH 18/21] AMP-63100 Swift v2 app: switch to Swift Package Manager instead of CocoaPods --- .github/workflows/ci-build-ios-v2-test.yml | 26 +--- .../project.pbxproj | 137 ++++-------------- .../xcshareddata/swiftpm/Package.resolved | 14 ++ .../contents.xcworkspacedata | 10 -- .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../AmpliSwiftSampleAppTests/AmpliTests.swift | 14 +- ios/swift/v2/AmpliSwiftSampleApp/Gemfile | 3 - ios/swift/v2/AmpliSwiftSampleApp/Podfile | 28 ---- ios/swift/v2/AmpliSwiftSampleApp/README.md | 6 +- 9 files changed, 56 insertions(+), 190 deletions(-) create mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Gemfile delete mode 100644 ios/swift/v2/AmpliSwiftSampleApp/Podfile diff --git a/.github/workflows/ci-build-ios-v2-test.yml b/.github/workflows/ci-build-ios-v2-test.yml index cc38c677..07be66e0 100644 --- a/.github/workflows/ci-build-ios-v2-test.yml +++ b/.github/workflows/ci-build-ios-v2-test.yml @@ -20,35 +20,11 @@ jobs: run: | sudo xcode-select -switch /Applications/Xcode_14.2.app - - name: Setup Ruby - uses: actions/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - - - name: Cache Bundle Gems and Cocoapods For Swift - id: cache-gems-pods - uses: actions/cache@v2 - with: - path: | - ./ios/swift/v2/AmpliSwiftSampleApp/Pods - ./ios/swift/v2/AmpliSwiftSampleApp/vendor/bundle - key: ${{ runner.os }}-ruby-${{ matrix.ruby-version }}-gems-${{ hashFiles('**/Gemfile.lock') }}-pods-${{ hashFiles('**/Podfile.lock') }} - - - name: Install Cocoapods For Swift - working-directory: ./ios/swift/v2/AmpliSwiftSampleApp - if: steps.cache-gems-pods.outputs.cache-hit != 'true' - run: | - gem install bundler - bundle config path vendor/bundle - bundle install - pod install - - name: Swfit iOS Tests working-directory: ./ios/swift/v2/AmpliSwiftSampleApp run: | - pod install xcodebuild test \ - -workspace AmpliSwiftSampleApp.xcworkspace \ + -project AmpliSwiftSampleApp.xcodeproj \ -scheme AmpliSwiftSampleAppTests \ -sdk iphonesimulator \ -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.2' diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj index 91b4c064..65d359f7 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj @@ -22,10 +22,8 @@ 3ECE2C47273F7B6C004EAA2C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3ECE2C30273F7B6C004EAA2C /* Assets.xcassets */; }; 3ECE2C532743332C004EAA2C /* Ampli.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C512743332C004EAA2C /* Ampli.swift */; }; 3ECE2C542743332C004EAA2C /* Ampli.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2C512743332C004EAA2C /* Ampli.swift */; }; - 82EA982A8CF090351192BDC5 /* libPods-AmpliSwiftSampleApp (iOS).a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DA67EDD533A140301A0ED6F /* libPods-AmpliSwiftSampleApp (iOS).a */; }; BA4436A82A84CCE4002F1115 /* LoggingPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA4436A72A84CCE4002F1115 /* LoggingPlugin.swift */; }; - DF74438E59F388DE0D5312C3 /* libPods-AmpliSwiftSampleAppTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FCF67013EA39835ADF064D05 /* libPods-AmpliSwiftSampleAppTests.a */; }; - F8D20984CBA9F9E8B7274DBB /* libPods-AmpliSwiftSampleApp (macOS).a in Frameworks */ = {isa = PBXBuildFile; fileRef = D320B081553D038DE2C3451F /* libPods-AmpliSwiftSampleApp (macOS).a */; }; + BA581AA22A8DF46300079EFE /* AmplitudeSwift in Frameworks */ = {isa = PBXBuildFile; productRef = BA581AA12A8DF46300079EFE /* AmplitudeSwift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -39,8 +37,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 1034F176E7CCBA34DE4EB867 /* Pods-AmpliSwiftSampleAppTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleAppTests.debug.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleAppTests/Pods-AmpliSwiftSampleAppTests.debug.xcconfig"; sourceTree = ""; }; - 2EE7856BA77896084D17D495 /* Pods-AmpliSwiftSampleApp (iOS).release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleApp (iOS).release.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleApp (iOS)/Pods-AmpliSwiftSampleApp (iOS).release.xcconfig"; sourceTree = ""; }; 3E3B5FA6275803D3003D95E1 /* AmpliSwiftSampleAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AmpliSwiftSampleAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3E3B5FAF2758045C003D95E1 /* AmpliTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmpliTests.swift; sourceTree = ""; }; 3E3B5FB127583BC9003D95E1 /* TextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = ""; }; @@ -53,14 +49,7 @@ 3ECE2C3B273F7B6C004EAA2C /* AmpliSwiftSampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AmpliSwiftSampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 3ECE2C3D273F7B6C004EAA2C /* macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macOS.entitlements; sourceTree = ""; }; 3ECE2C512743332C004EAA2C /* Ampli.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Ampli.swift; sourceTree = ""; }; - 4874785F85542D07984AFD54 /* Pods-AmpliSwiftSampleAppTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleAppTests.release.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleAppTests/Pods-AmpliSwiftSampleAppTests.release.xcconfig"; sourceTree = ""; }; - 9DA67EDD533A140301A0ED6F /* libPods-AmpliSwiftSampleApp (iOS).a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AmpliSwiftSampleApp (iOS).a"; sourceTree = BUILT_PRODUCTS_DIR; }; - AA54015EF375CC8893FEC6CC /* Pods-AmpliSwiftSampleApp (macOS).release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleApp (macOS).release.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleApp (macOS)/Pods-AmpliSwiftSampleApp (macOS).release.xcconfig"; sourceTree = ""; }; BA4436A72A84CCE4002F1115 /* LoggingPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggingPlugin.swift; sourceTree = ""; }; - D0BAADDDB89B39695FCD3EDF /* Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleApp (macOS)/Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig"; sourceTree = ""; }; - D320B081553D038DE2C3451F /* libPods-AmpliSwiftSampleApp (macOS).a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AmpliSwiftSampleApp (macOS).a"; sourceTree = BUILT_PRODUCTS_DIR; }; - FC778F7F39B4D2F8F3596B35 /* Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig"; path = "Target Support Files/Pods-AmpliSwiftSampleApp (iOS)/Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig"; sourceTree = ""; }; - FCF67013EA39835ADF064D05 /* libPods-AmpliSwiftSampleAppTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AmpliSwiftSampleAppTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -68,7 +57,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DF74438E59F388DE0D5312C3 /* libPods-AmpliSwiftSampleAppTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -76,7 +64,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 82EA982A8CF090351192BDC5 /* libPods-AmpliSwiftSampleApp (iOS).a in Frameworks */, + BA581AA22A8DF46300079EFE /* AmplitudeSwift in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -84,7 +72,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F8D20984CBA9F9E8B7274DBB /* libPods-AmpliSwiftSampleApp (macOS).a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -107,7 +94,6 @@ 3E3B5FA7275803D3003D95E1 /* AmpliSwiftSampleAppTests */, 3ECE2C36273F7B6C004EAA2C /* Products */, B8E184F982BAB6A9F0F2440E /* Pods */, - F0B610FBE681A3D6E6570E2C /* Frameworks */, ); sourceTree = ""; }; @@ -155,12 +141,6 @@ B8E184F982BAB6A9F0F2440E /* Pods */ = { isa = PBXGroup; children = ( - FC778F7F39B4D2F8F3596B35 /* Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig */, - 2EE7856BA77896084D17D495 /* Pods-AmpliSwiftSampleApp (iOS).release.xcconfig */, - D0BAADDDB89B39695FCD3EDF /* Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig */, - AA54015EF375CC8893FEC6CC /* Pods-AmpliSwiftSampleApp (macOS).release.xcconfig */, - 1034F176E7CCBA34DE4EB867 /* Pods-AmpliSwiftSampleAppTests.debug.xcconfig */, - 4874785F85542D07984AFD54 /* Pods-AmpliSwiftSampleAppTests.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -173,16 +153,6 @@ path = Plugins; sourceTree = ""; }; - F0B610FBE681A3D6E6570E2C /* Frameworks */ = { - isa = PBXGroup; - children = ( - 9DA67EDD533A140301A0ED6F /* libPods-AmpliSwiftSampleApp (iOS).a */, - D320B081553D038DE2C3451F /* libPods-AmpliSwiftSampleApp (macOS).a */, - FCF67013EA39835ADF064D05 /* libPods-AmpliSwiftSampleAppTests.a */, - ); - name = Frameworks; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -190,7 +160,6 @@ isa = PBXNativeTarget; buildConfigurationList = 3E3B5FAE275803D3003D95E1 /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleAppTests" */; buildPhases = ( - 5AAE05862366F33457B6CB7A /* [CP] Check Pods Manifest.lock */, 3E3B5FA2275803D3003D95E1 /* Sources */, 3E3B5FA3275803D3003D95E1 /* Frameworks */, 3E3B5FA4275803D3003D95E1 /* Resources */, @@ -209,7 +178,6 @@ isa = PBXNativeTarget; buildConfigurationList = 3ECE2C4A273F7B6C004EAA2C /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleApp (iOS)" */; buildPhases = ( - 47870903BBE4154AF2CAF117 /* [CP] Check Pods Manifest.lock */, 3ECE2C31273F7B6C004EAA2C /* Sources */, 3ECE2C32273F7B6C004EAA2C /* Frameworks */, 3ECE2C33273F7B6C004EAA2C /* Resources */, @@ -219,6 +187,9 @@ dependencies = ( ); name = "AmpliSwiftSampleApp (iOS)"; + packageProductDependencies = ( + BA581AA12A8DF46300079EFE /* AmplitudeSwift */, + ); productName = "AmpliSwiftSampleApp (iOS)"; productReference = 3ECE2C35273F7B6C004EAA2C /* AmpliSwiftSampleApp.app */; productType = "com.apple.product-type.application"; @@ -227,7 +198,6 @@ isa = PBXNativeTarget; buildConfigurationList = 3ECE2C4D273F7B6C004EAA2C /* Build configuration list for PBXNativeTarget "AmpliSwiftSampleApp (macOS)" */; buildPhases = ( - D3903C8E82AE1D3F9503D24A /* [CP] Check Pods Manifest.lock */, 3ECE2C37273F7B6C004EAA2C /* Sources */, 3ECE2C38273F7B6C004EAA2C /* Frameworks */, 3ECE2C39273F7B6C004EAA2C /* Resources */, @@ -272,6 +242,9 @@ Base, ); mainGroup = 3ECE2C25273F7B65004EAA2C; + packageReferences = ( + BA581AA02A8DF46200079EFE /* XCRemoteSwiftPackageReference "Amplitude-Swift" */, + ); productRefGroup = 3ECE2C36273F7B6C004EAA2C /* Products */; projectDirPath = ""; projectRoot = ""; @@ -309,75 +282,6 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 47870903BBE4154AF2CAF117 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-AmpliSwiftSampleApp (iOS)-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 5AAE05862366F33457B6CB7A /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-AmpliSwiftSampleAppTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - D3903C8E82AE1D3F9503D24A /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-AmpliSwiftSampleApp (macOS)-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ 3E3B5FA2275803D3003D95E1 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -427,7 +331,6 @@ /* Begin XCBuildConfiguration section */ 3E3B5FAC275803D3003D95E1 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 1034F176E7CCBA34DE4EB867 /* Pods-AmpliSwiftSampleAppTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -452,7 +355,6 @@ }; 3E3B5FAD275803D3003D95E1 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 4874785F85542D07984AFD54 /* Pods-AmpliSwiftSampleAppTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -589,7 +491,6 @@ }; 3ECE2C4B273F7B6C004EAA2C /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FC778F7F39B4D2F8F3596B35 /* Pods-AmpliSwiftSampleApp (iOS).debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -619,7 +520,6 @@ }; 3ECE2C4C273F7B6C004EAA2C /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 2EE7856BA77896084D17D495 /* Pods-AmpliSwiftSampleApp (iOS).release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -650,7 +550,6 @@ }; 3ECE2C4E273F7B6C004EAA2C /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D0BAADDDB89B39695FCD3EDF /* Pods-AmpliSwiftSampleApp (macOS).debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -678,7 +577,6 @@ }; 3ECE2C4F273F7B6C004EAA2C /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = AA54015EF375CC8893FEC6CC /* Pods-AmpliSwiftSampleApp (macOS).release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -745,6 +643,25 @@ }; /* End XCConfigurationList section */ +/* Begin XCRemoteSwiftPackageReference section */ + BA581AA02A8DF46200079EFE /* XCRemoteSwiftPackageReference "Amplitude-Swift" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/amplitude/Amplitude-Swift"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 0.4.13; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + BA581AA12A8DF46300079EFE /* AmplitudeSwift */ = { + isa = XCSwiftPackageProductDependency; + package = BA581AA02A8DF46200079EFE /* XCRemoteSwiftPackageReference "Amplitude-Swift" */; + productName = AmplitudeSwift; + }; +/* End XCSwiftPackageProductDependency section */ + /* Begin XCVersionGroup section */ 3ECE2C2B273F7B65004EAA2C /* AmpliSwiftSampleApp.xcdatamodeld */ = { isa = XCVersionGroup; 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 new file mode 100644 index 00000000..2fca6227 --- /dev/null +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "amplitude-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/amplitude/Amplitude-Swift", + "state" : { + "revision" : "ce5bea4b988a2a2fff7fda01bde61321d9af18df", + "version" : "0.4.13" + } + } + ], + "version" : 2 +} diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 24de21e1..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift index c282825b..26415045 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift @@ -195,10 +195,20 @@ class AmpliTests: XCTestCase { } } -class EventCollectorPlugin: DestinationPlugin { +class EventCollectorPlugin: Plugin { + var type: PluginType + var amplitude: Amplitude? var events: [BaseEvent] = Array() - override func execute(event: BaseEvent) -> BaseEvent? { + init() { + self.type = .destination + } + + func setup(amplitude: Amplitude) { + self.amplitude = amplitude + } + + func execute(event: BaseEvent) -> BaseEvent? { events.append(event) return event } diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Gemfile b/ios/swift/v2/AmpliSwiftSampleApp/Gemfile deleted file mode 100644 index 538c58aa..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source 'https://rubygems.org' - -gem 'cocoapods', '~>1.1' diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Podfile b/ios/swift/v2/AmpliSwiftSampleApp/Podfile deleted file mode 100644 index 79e29314..00000000 --- a/ios/swift/v2/AmpliSwiftSampleApp/Podfile +++ /dev/null @@ -1,28 +0,0 @@ -def import_pods - -pod 'AmplitudeSwift', "~> 0.4.14" - -end - -inhibit_all_warnings! - -target 'AmpliSwiftSampleApp (iOS)' do - project "AmpliSwiftSampleApp" - platform :ios, '15.0' - - import_pods -end - -target 'AmpliSwiftSampleApp (macOS)' do - platform :macos, '12.0' - project "AmpliSwiftSampleApp" - - import_pods -end - -target 'AmpliSwiftSampleAppTests' do - platform :ios, '15.0' - project "AmpliSwiftSampleApp" - - import_pods -end diff --git a/ios/swift/v2/AmpliSwiftSampleApp/README.md b/ios/swift/v2/AmpliSwiftSampleApp/README.md index 0841cc11..da67c4aa 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/README.md +++ b/ios/swift/v2/AmpliSwiftSampleApp/README.md @@ -5,11 +5,10 @@ An example app using the Ampli Swift SDK V2. ### Setup the project You will need to do the following before running the app. -1.Set up environment variable with your API keys +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. `pod install` -3. Open `AmpliSwiftSampleApp.xcworkspace` with Xcode +2. Open `AmpliSwiftSampleApp.xcodeproj` with Xcode ### Run the app You can run the app using the events from our sample tracking plan. @@ -24,7 +23,6 @@ If you want to use your own tracking plan and Ampli SDK # Project structure * README.md - you are here * -* Podfile - pods dependency * Shared/ * [AmpliSwiftSampleAppApp](Shared/AmpliSwiftSampleAppApp.swift) - Example user app using Ampli SDK. A good place to start. * [TextView](Shared/TextView.swift) - Example user app using Ampli SDK. A good place to start. From 04637f479172c6a1ac8a0d2da84a2982ad682d9d Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Thu, 17 Aug 2023 11:44:02 +0400 Subject: [PATCH 19/21] AMP-63100 Swift v2 app: update Ampli.swift --- .../AmpliSwiftSampleAppTests/AmpliTests.swift | 2 +- .../v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift index 26415045..287f9f72 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift @@ -15,7 +15,7 @@ class AmpliTests: XCTestCase { } func initAmpliWithNewInstance(_ instanceName: String) { - ampli.load(LoadOptions(client: LoadClientOptions(config: Configuration( + ampli.load(LoadOptions(client: LoadClientOptions(configuration: Configuration( apiKey: "test-api-key", instanceName: instanceName, trackingSessionEvents: false, diff --git a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift index adb69645..00f42719 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift @@ -507,12 +507,12 @@ public class EventMaxIntForTest : GenericEvent { public struct LoadClientOptions { public let apiKey: String? public let instance: Amplitude? - public let config: Configuration? + public let configuration: Configuration? - public init(apiKey: String? = nil, instance: Amplitude? = nil, config: Configuration? = nil) { + public init(apiKey: String? = nil, instance: Amplitude? = nil, configuration: Configuration? = nil) { self.apiKey = apiKey self.instance = instance - self.config = config + self.configuration = configuration } } @@ -571,8 +571,8 @@ public class Ampli { if let clientApiKey = options.client?.apiKey { apiKey = clientApiKey - } else if let configApiKey = options.client?.config?.apiKey { - apiKey = configApiKey + } else if let configurationApiKey = options.client?.configuration?.apiKey { + apiKey = configurationApiKey } else if let environment = options.environment { apiKey = ApiKey[environment] } @@ -580,7 +580,7 @@ public class Ampli { if let instance = options.client?.instance { self.amplitude = instance } else if let apiKey = apiKey { - let configuration = options.client?.config ?? Configuration( + let configuration = options.client?.configuration ?? Configuration( apiKey: apiKey ) if configuration.plan == nil { From 237b836db7cd769ac5831951b16250b8c24e535d Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Fri, 18 Aug 2023 16:22:37 +0400 Subject: [PATCH 20/21] AMP-63100 Swift v2 app: minor fixes --- .github/workflows/ci-build-ios-v1-test.yml | 2 +- .github/workflows/ci-build-ios-v2-test.yml | 2 +- ios/swift/v1/AmpliSwiftSampleApp/README.md | 4 ++-- .../AmpliSwiftSampleApp.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- .../AmpliSwiftSampleAppTests/AmpliTests.swift | 14 ++------------ ios/swift/v2/AmpliSwiftSampleApp/README.md | 4 ++-- 7 files changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci-build-ios-v1-test.yml b/.github/workflows/ci-build-ios-v1-test.yml index 8e22aa6a..a6212e67 100644 --- a/.github/workflows/ci-build-ios-v1-test.yml +++ b/.github/workflows/ci-build-ios-v1-test.yml @@ -44,7 +44,7 @@ jobs: bundle install pod install - - name: Swfit iOS Tests + - name: Swift iOS Tests working-directory: ./ios/swift/v1/AmpliSwiftSampleApp run: | pod install diff --git a/.github/workflows/ci-build-ios-v2-test.yml b/.github/workflows/ci-build-ios-v2-test.yml index 07be66e0..5e2b3bdf 100644 --- a/.github/workflows/ci-build-ios-v2-test.yml +++ b/.github/workflows/ci-build-ios-v2-test.yml @@ -20,7 +20,7 @@ jobs: run: | sudo xcode-select -switch /Applications/Xcode_14.2.app - - name: Swfit iOS Tests + - name: Swift iOS Tests working-directory: ./ios/swift/v2/AmpliSwiftSampleApp run: | xcodebuild test \ diff --git a/ios/swift/v1/AmpliSwiftSampleApp/README.md b/ios/swift/v1/AmpliSwiftSampleApp/README.md index 9497f8cf..9bc02b9a 100644 --- a/ios/swift/v1/AmpliSwiftSampleApp/README.md +++ b/ios/swift/v1/AmpliSwiftSampleApp/README.md @@ -27,7 +27,7 @@ If you want to use your own tracking plan and Ampli SDK * Podfile - pods dependency * Shared/ * [AmpliSwiftSampleAppApp](Shared/AmpliSwiftSampleAppApp.swift) - Example user app using Ampli SDK. A good place to start. - * [TextView](Shared/TextView.swift) - Example user app using Ampli SDK. A good place to start. - * [ContentView](Shared/ContentView.swift) - Example user app using Ampli SDK. A good place to start. + * [TextView](Shared/TextView.swift) - Ampli SDK usage in a TextView. + * [ContentView](Shared/ContentView.swift) - Ampli SDK usage in a ContentView. * Ampli/ * [Ampli.swift](Shared/Ampli/Ampli.swift) - Generated SDK, don't modify by hand. Update with `ampli pull` diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleApp.xcodeproj/project.pbxproj index 65d359f7..a8a8c5e3 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.13; + minimumVersion = 0.4.14; }; }; /* 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 2fca6227..94628004 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,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/amplitude/Amplitude-Swift", "state" : { - "revision" : "ce5bea4b988a2a2fff7fda01bde61321d9af18df", - "version" : "0.4.13" + "revision" : "8293ca0b09aac19b7c87f51ad0386590a066e71f", + "version" : "0.4.14" } } ], diff --git a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift index 287f9f72..34c5fa30 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift +++ b/ios/swift/v2/AmpliSwiftSampleApp/AmpliSwiftSampleAppTests/AmpliTests.swift @@ -195,20 +195,10 @@ class AmpliTests: XCTestCase { } } -class EventCollectorPlugin: Plugin { - var type: PluginType - var amplitude: Amplitude? +class EventCollectorPlugin: DestinationPlugin { var events: [BaseEvent] = Array() - init() { - self.type = .destination - } - - func setup(amplitude: Amplitude) { - self.amplitude = amplitude - } - - func execute(event: BaseEvent) -> BaseEvent? { + public override func execute(event: BaseEvent) -> BaseEvent? { events.append(event) return event } diff --git a/ios/swift/v2/AmpliSwiftSampleApp/README.md b/ios/swift/v2/AmpliSwiftSampleApp/README.md index da67c4aa..786e69ce 100644 --- a/ios/swift/v2/AmpliSwiftSampleApp/README.md +++ b/ios/swift/v2/AmpliSwiftSampleApp/README.md @@ -25,7 +25,7 @@ If you want to use your own tracking plan and Ampli SDK * README.md - you are here * * Shared/ * [AmpliSwiftSampleAppApp](Shared/AmpliSwiftSampleAppApp.swift) - Example user app using Ampli SDK. A good place to start. - * [TextView](Shared/TextView.swift) - Example user app using Ampli SDK. A good place to start. - * [ContentView](Shared/ContentView.swift) - Example user app using Ampli SDK. A good place to start. + * [TextView](Shared/TextView.swift) - Ampli SDK usage in a TextView. + * [ContentView](Shared/ContentView.swift) - Ampli SDK usage in a ContentView. * Ampli/ * [Ampli.swift](Shared/Ampli/Ampli.swift) - Generated SDK, don't modify by hand. Update with `ampli pull` From 7c73cc61720b1018ddb60fa93e5254cf3f79987f Mon Sep 17 00:00:00 2001 From: Andrey Sokolov Date: Wed, 23 Aug 2023 21:53:44 +0400 Subject: [PATCH 21/21] AMP-63100 Move current Objective-C example to v1 subfolder --- .github/workflows/ampli-merge-check.ios.yml | 2 +- .github/workflows/ci-build-ios-v1-test.yml | 10 +++++----- README.md | 2 +- .../AmpliObjectiveCSampleApp.xcodeproj/project.pbxproj | 0 .../project.xcworkspace/contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../xcschemes/AmpliObjectiveCSampleApp.xcscheme | 0 .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../AmpliObjectiveCSampleApp/Ampli/Ampli.h | 0 .../AmpliObjectiveCSampleApp/Ampli/Ampli.m | 0 .../AmpliObjectiveCSampleApp/AppDelegate.h | 0 .../AmpliObjectiveCSampleApp/AppDelegate.m | 0 .../Assets.xcassets/AccentColor.colorset/Contents.json | 0 .../Assets.xcassets/AppIcon.appiconset/Contents.json | 0 .../Assets.xcassets/Contents.json | 0 .../Base.lproj/LaunchScreen.storyboard | 0 .../Base.lproj/Main.storyboard | 0 .../AmpliObjectiveCSampleApp/Info.plist | 0 .../AmpliObjectiveCSampleApp/SceneDelegate.h | 0 .../AmpliObjectiveCSampleApp/SceneDelegate.m | 0 .../AmpliObjectiveCSampleApp/ViewController.h | 0 .../AmpliObjectiveCSampleApp/ViewController.m | 0 .../AmpliObjectiveCSampleApp/main.m | 0 .../AmpliObjectiveCSampleAppTests/AmpliTests.m | 0 .../{ => v1}/AmpliObjectiveCSampleApp/Gemfile | 0 .../{ => v1}/AmpliObjectiveCSampleApp/Podfile | 0 .../{ => v1}/AmpliObjectiveCSampleApp/README.md | 0 .../{ => v1}/AmpliObjectiveCSampleApp/ampli.json | 0 29 files changed, 7 insertions(+), 7 deletions(-) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.pbxproj (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliObjectiveCSampleApp.xcscheme (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcworkspace/contents.xcworkspacedata (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.h (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.m (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.h (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.m (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/Contents.json (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/LaunchScreen.storyboard (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/Main.storyboard (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Info.plist (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.h (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.m (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.h (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.m (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/main.m (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleAppTests/AmpliTests.m (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/Gemfile (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/Podfile (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/README.md (100%) rename ios/objective-c/{ => v1}/AmpliObjectiveCSampleApp/ampli.json (100%) diff --git a/.github/workflows/ampli-merge-check.ios.yml b/.github/workflows/ampli-merge-check.ios.yml index ce1834c2..af428b98 100644 --- a/.github/workflows/ampli-merge-check.ios.yml +++ b/.github/workflows/ampli-merge-check.ios.yml @@ -28,5 +28,5 @@ jobs: run: ampli status --is-merged -t ${{secrets.AMPLI_TOKEN}} - name: (iOS Objective-C) Check the Data branch is merged before merging the Git branch - working-directory: ./ios/objective-c/AmpliObjectiveCSampleApp + working-directory: ./ios/objective-c/v1/AmpliObjectiveCSampleApp run: ampli status --is-merged -t ${{secrets.AMPLI_TOKEN}} diff --git a/.github/workflows/ci-build-ios-v1-test.yml b/.github/workflows/ci-build-ios-v1-test.yml index a6212e67..a20b45a9 100644 --- a/.github/workflows/ci-build-ios-v1-test.yml +++ b/.github/workflows/ci-build-ios-v1-test.yml @@ -3,7 +3,7 @@ name: CI - iOS V1 Tests on: pull_request: paths: - - 'ios/objective-c/**' + - 'ios/objective-c/v1/**' - 'ios/swift/v1/**' jobs: @@ -59,12 +59,12 @@ jobs: uses: actions/cache@v2 with: path: | - ./ios/objective-c/AmpliObjectiveCSampleApp/Pods - ./ios/objective-c/AmpliObjectiveCSampleApp/vendor/bundle + ./ios/objective-c/v1/AmpliObjectiveCSampleApp/Pods + ./ios/objective-c/v1/AmpliObjectiveCSampleApp/vendor/bundle key: ${{ runner.os }}-ruby-${{ matrix.ruby-version }}-gems-${{ hashFiles('**/Gemfile.lock') }}-pods-${{ hashFiles('**/Podfile.lock') }} - name: Install Cocoapods For Objective-C - working-directory: ./ios/objective-c/AmpliObjectiveCSampleApp + working-directory: ./ios/objective-c/v1/AmpliObjectiveCSampleApp if: steps.cache-gems-objc-pods.outputs.cache-hit != 'true' run: | gem install bundler @@ -73,7 +73,7 @@ jobs: pod install - name: Objective-C iOS Tests - working-directory: ./ios/objective-c/AmpliObjectiveCSampleApp + working-directory: ./ios/objective-c/v1/AmpliObjectiveCSampleApp run: | pod install xcodebuild test \ diff --git a/README.md b/README.md index 0aeab8bb..c1ff1719 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ See subproject README's for details on each platform. ## iOS V1 #### [ios/swift](ios/swift/v1/AmpliSwiftSampleApp) -#### [ios/objective-c](ios/objective-c/AmpliObjectiveCSampleApp) +#### [ios/objective-c](ios/objective-c/v1/AmpliObjectiveCSampleApp) ## iOS V2 #### [ios/swift](ios/swift/v2/AmpliSwiftSampleApp) diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.pbxproj b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.pbxproj similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.pbxproj rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.pbxproj diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliObjectiveCSampleApp.xcscheme b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliObjectiveCSampleApp.xcscheme similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliObjectiveCSampleApp.xcscheme rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcodeproj/xcshareddata/xcschemes/AmpliObjectiveCSampleApp.xcscheme diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcworkspace/contents.xcworkspacedata b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcworkspace/contents.xcworkspacedata similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcworkspace/contents.xcworkspacedata rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcworkspace/contents.xcworkspacedata diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.h b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.h similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.h rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.h diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.m b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.m similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.m rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Ampli/Ampli.m diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.h b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.h similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.h rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.h diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.m b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.m similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.m rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/AppDelegate.m diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/Contents.json b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/Contents.json similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/Contents.json rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Assets.xcassets/Contents.json diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/LaunchScreen.storyboard b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/LaunchScreen.storyboard rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/LaunchScreen.storyboard diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/Main.storyboard b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/Main.storyboard similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/Main.storyboard rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Base.lproj/Main.storyboard diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Info.plist b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Info.plist similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Info.plist rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/Info.plist diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.h b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.h similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.h rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.h diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.m b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.m similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.m rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/SceneDelegate.m diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.h b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.h similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.h rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.h diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.m b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.m similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.m rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/ViewController.m diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/main.m b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/main.m similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/main.m rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleApp/main.m diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleAppTests/AmpliTests.m b/ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleAppTests/AmpliTests.m similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleAppTests/AmpliTests.m rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/AmpliObjectiveCSampleAppTests/AmpliTests.m diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/Gemfile b/ios/objective-c/v1/AmpliObjectiveCSampleApp/Gemfile similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/Gemfile rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/Gemfile diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/Podfile b/ios/objective-c/v1/AmpliObjectiveCSampleApp/Podfile similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/Podfile rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/Podfile diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/README.md b/ios/objective-c/v1/AmpliObjectiveCSampleApp/README.md similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/README.md rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/README.md diff --git a/ios/objective-c/AmpliObjectiveCSampleApp/ampli.json b/ios/objective-c/v1/AmpliObjectiveCSampleApp/ampli.json similarity index 100% rename from ios/objective-c/AmpliObjectiveCSampleApp/ampli.json rename to ios/objective-c/v1/AmpliObjectiveCSampleApp/ampli.json