From daf14ee9aecc63eb35016c5da1063ab7b7a1f331 Mon Sep 17 00:00:00 2001 From: Jonathan Samudio Date: Tue, 21 Feb 2017 16:24:52 -0500 Subject: [PATCH 01/11] Added simcoe example project. --- SimcoeExample/Podfile | 10 + SimcoeExample/Podfile.lock | 27 + .../SimcoeExample.xcodeproj/project.pbxproj | 504 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../contents.xcworkspacedata | 10 + SimcoeExample/SimcoeExample/AppDelegate.swift | 46 ++ .../AppIcon.appiconset/Contents.json | 38 ++ .../Base.lproj/LaunchScreen.storyboard | 27 + .../SimcoeExample/Base.lproj/Main.storyboard | 26 + SimcoeExample/SimcoeExample/Info.plist | 38 ++ .../SimcoeExample/ViewController.swift | 25 + SimcoeExample/SimcoeExampleTests/Info.plist | 22 + .../SimcoeExampleTests.swift | 36 ++ 13 files changed, 816 insertions(+) create mode 100644 SimcoeExample/Podfile create mode 100644 SimcoeExample/Podfile.lock create mode 100644 SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj create mode 100644 SimcoeExample/SimcoeExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 SimcoeExample/SimcoeExample.xcworkspace/contents.xcworkspacedata create mode 100644 SimcoeExample/SimcoeExample/AppDelegate.swift create mode 100644 SimcoeExample/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 SimcoeExample/SimcoeExample/Base.lproj/LaunchScreen.storyboard create mode 100644 SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard create mode 100644 SimcoeExample/SimcoeExample/Info.plist create mode 100644 SimcoeExample/SimcoeExample/ViewController.swift create mode 100644 SimcoeExample/SimcoeExampleTests/Info.plist create mode 100644 SimcoeExample/SimcoeExampleTests/SimcoeExampleTests.swift diff --git a/SimcoeExample/Podfile b/SimcoeExample/Podfile new file mode 100644 index 0000000..3b5d658 --- /dev/null +++ b/SimcoeExample/Podfile @@ -0,0 +1,10 @@ +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, ‘9.0’ +use_frameworks! +inhibit_all_warnings! + +target 'SimcoeExample’ do + + pod 'Simcoe', :subspecs => ['Adobe', 'mParticle'] + +end diff --git a/SimcoeExample/Podfile.lock b/SimcoeExample/Podfile.lock new file mode 100644 index 0000000..b5ab869 --- /dev/null +++ b/SimcoeExample/Podfile.lock @@ -0,0 +1,27 @@ +PODS: + - AdobeMobileSDK (4.13.3): + - AdobeMobileSDK/iOS (= 4.13.3) + - AdobeMobileSDK/iOS (4.13.3) + - mParticle-Apple-SDK (6.12.3): + - mParticle-Apple-SDK/mParticle (= 6.12.3) + - mParticle-Apple-SDK/mParticle (6.12.3) + - Simcoe/Adobe (0.5.1): + - AdobeMobileSDK (~> 4.13) + - Simcoe/Core + - Simcoe/Core (0.5.1) + - Simcoe/mParticle (0.5.1): + - mParticle-Apple-SDK (~> 6) + - Simcoe/Core + +DEPENDENCIES: + - Simcoe/Adobe + - Simcoe/mParticle + +SPEC CHECKSUMS: + AdobeMobileSDK: 10bf49f2d5714b057615fbd9ade3ac2cfbff8316 + mParticle-Apple-SDK: aa8648804e27986d1a7df36f222e93ef9cee2e9f + Simcoe: d640f0404f60167189f86175a5d9ca96092a1ad7 + +PODFILE CHECKSUM: 580a39f57c913a79d766c549c729802bc4de85b8 + +COCOAPODS: 1.1.1 diff --git a/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj b/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1a64cd1 --- /dev/null +++ b/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj @@ -0,0 +1,504 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 17923EF38131CF03F54F6E9D /* Pods_SimcoeExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 431A5FFF8F112E2B83CCE282 /* Pods_SimcoeExample.framework */; }; + 20C3B1B11E5CE6F70095F185 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */; }; + 20C3B1B31E5CE6F70095F185 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1B21E5CE6F70095F185 /* ViewController.swift */; }; + 20C3B1B61E5CE6F70095F185 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B41E5CE6F70095F185 /* Main.storyboard */; }; + 20C3B1B81E5CE6F70095F185 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */; }; + 20C3B1BB1E5CE6F70095F185 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B91E5CE6F70095F185 /* LaunchScreen.storyboard */; }; + 20C3B1C61E5CE6F80095F185 /* SimcoeExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1C51E5CE6F80095F185 /* SimcoeExampleTests.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 20C3B1C21E5CE6F80095F185 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 20C3B1A51E5CE6F70095F185 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 20C3B1AC1E5CE6F70095F185; + remoteInfo = SimcoeExample; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 20C3B1AD1E5CE6F70095F185 /* SimcoeExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimcoeExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 20C3B1B21E5CE6F70095F185 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 20C3B1B51E5CE6F70095F185 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 20C3B1BA1E5CE6F70095F185 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 20C3B1BC1E5CE6F70095F185 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 20C3B1C11E5CE6F80095F185 /* SimcoeExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SimcoeExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 20C3B1C51E5CE6F80095F185 /* SimcoeExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimcoeExampleTests.swift; sourceTree = ""; }; + 20C3B1C71E5CE6F80095F185 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 431A5FFF8F112E2B83CCE282 /* Pods_SimcoeExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SimcoeExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6705DEBD5E0BA9CA1E336C0F /* Pods-SimcoeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SimcoeExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample.debug.xcconfig"; sourceTree = ""; }; + 96D6CBE7E25C6571D36DD4FB /* Pods-SimcoeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SimcoeExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 20C3B1AA1E5CE6F70095F185 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 17923EF38131CF03F54F6E9D /* Pods_SimcoeExample.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 20C3B1BE1E5CE6F80095F185 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 20C3B1A41E5CE6F70095F185 = { + isa = PBXGroup; + children = ( + 20C3B1AF1E5CE6F70095F185 /* SimcoeExample */, + 20C3B1C41E5CE6F80095F185 /* SimcoeExampleTests */, + 20C3B1AE1E5CE6F70095F185 /* Products */, + C7C320D69EA0D1C563FF3995 /* Pods */, + F9408D272EA2E6886CDC6D26 /* Frameworks */, + ); + sourceTree = ""; + }; + 20C3B1AE1E5CE6F70095F185 /* Products */ = { + isa = PBXGroup; + children = ( + 20C3B1AD1E5CE6F70095F185 /* SimcoeExample.app */, + 20C3B1C11E5CE6F80095F185 /* SimcoeExampleTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 20C3B1AF1E5CE6F70095F185 /* SimcoeExample */ = { + isa = PBXGroup; + children = ( + 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */, + 20C3B1B21E5CE6F70095F185 /* ViewController.swift */, + 20C3B1B41E5CE6F70095F185 /* Main.storyboard */, + 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */, + 20C3B1B91E5CE6F70095F185 /* LaunchScreen.storyboard */, + 20C3B1BC1E5CE6F70095F185 /* Info.plist */, + ); + path = SimcoeExample; + sourceTree = ""; + }; + 20C3B1C41E5CE6F80095F185 /* SimcoeExampleTests */ = { + isa = PBXGroup; + children = ( + 20C3B1C51E5CE6F80095F185 /* SimcoeExampleTests.swift */, + 20C3B1C71E5CE6F80095F185 /* Info.plist */, + ); + path = SimcoeExampleTests; + sourceTree = ""; + }; + C7C320D69EA0D1C563FF3995 /* Pods */ = { + isa = PBXGroup; + children = ( + 6705DEBD5E0BA9CA1E336C0F /* Pods-SimcoeExample.debug.xcconfig */, + 96D6CBE7E25C6571D36DD4FB /* Pods-SimcoeExample.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + F9408D272EA2E6886CDC6D26 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 431A5FFF8F112E2B83CCE282 /* Pods_SimcoeExample.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 20C3B1AC1E5CE6F70095F185 /* SimcoeExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 20C3B1CA1E5CE6F80095F185 /* Build configuration list for PBXNativeTarget "SimcoeExample" */; + buildPhases = ( + F6BE0E261E5827888F00C654 /* [CP] Check Pods Manifest.lock */, + 20C3B1A91E5CE6F70095F185 /* Sources */, + 20C3B1AA1E5CE6F70095F185 /* Frameworks */, + 20C3B1AB1E5CE6F70095F185 /* Resources */, + 8ACB246C83C58B83E0AEBFF0 /* [CP] Embed Pods Frameworks */, + 46EA684A0296F94B24CD361E /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SimcoeExample; + productName = SimcoeExample; + productReference = 20C3B1AD1E5CE6F70095F185 /* SimcoeExample.app */; + productType = "com.apple.product-type.application"; + }; + 20C3B1C01E5CE6F80095F185 /* SimcoeExampleTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 20C3B1CD1E5CE6F80095F185 /* Build configuration list for PBXNativeTarget "SimcoeExampleTests" */; + buildPhases = ( + 20C3B1BD1E5CE6F80095F185 /* Sources */, + 20C3B1BE1E5CE6F80095F185 /* Frameworks */, + 20C3B1BF1E5CE6F80095F185 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 20C3B1C31E5CE6F80095F185 /* PBXTargetDependency */, + ); + name = SimcoeExampleTests; + productName = SimcoeExampleTests; + productReference = 20C3B1C11E5CE6F80095F185 /* SimcoeExampleTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 20C3B1A51E5CE6F70095F185 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0820; + LastUpgradeCheck = 0820; + ORGANIZATIONNAME = "Prolific Interactive"; + TargetAttributes = { + 20C3B1AC1E5CE6F70095F185 = { + CreatedOnToolsVersion = 8.2.1; + DevelopmentTeam = 5ZZ7W4SB26; + ProvisioningStyle = Automatic; + }; + 20C3B1C01E5CE6F80095F185 = { + CreatedOnToolsVersion = 8.2.1; + DevelopmentTeam = 5ZZ7W4SB26; + ProvisioningStyle = Automatic; + TestTargetID = 20C3B1AC1E5CE6F70095F185; + }; + }; + }; + buildConfigurationList = 20C3B1A81E5CE6F70095F185 /* Build configuration list for PBXProject "SimcoeExample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 20C3B1A41E5CE6F70095F185; + productRefGroup = 20C3B1AE1E5CE6F70095F185 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 20C3B1AC1E5CE6F70095F185 /* SimcoeExample */, + 20C3B1C01E5CE6F80095F185 /* SimcoeExampleTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 20C3B1AB1E5CE6F70095F185 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 20C3B1BB1E5CE6F70095F185 /* LaunchScreen.storyboard in Resources */, + 20C3B1B81E5CE6F70095F185 /* Assets.xcassets in Resources */, + 20C3B1B61E5CE6F70095F185 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 20C3B1BF1E5CE6F80095F185 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 46EA684A0296F94B24CD361E /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 8ACB246C83C58B83E0AEBFF0 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + F6BE0E261E5827888F00C654 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../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"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 20C3B1A91E5CE6F70095F185 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 20C3B1B31E5CE6F70095F185 /* ViewController.swift in Sources */, + 20C3B1B11E5CE6F70095F185 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 20C3B1BD1E5CE6F80095F185 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 20C3B1C61E5CE6F80095F185 /* SimcoeExampleTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 20C3B1C31E5CE6F80095F185 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 20C3B1AC1E5CE6F70095F185 /* SimcoeExample */; + targetProxy = 20C3B1C21E5CE6F80095F185 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 20C3B1B41E5CE6F70095F185 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 20C3B1B51E5CE6F70095F185 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 20C3B1B91E5CE6F70095F185 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 20C3B1BA1E5CE6F70095F185 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 20C3B1C81E5CE6F80095F185 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 20C3B1C91E5CE6F80095F185 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 20C3B1CB1E5CE6F80095F185 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6705DEBD5E0BA9CA1E336C0F /* Pods-SimcoeExample.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 5ZZ7W4SB26; + INFOPLIST_FILE = SimcoeExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 20C3B1CC1E5CE6F80095F185 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 96D6CBE7E25C6571D36DD4FB /* Pods-SimcoeExample.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 5ZZ7W4SB26; + INFOPLIST_FILE = SimcoeExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + 20C3B1CE1E5CE6F80095F185 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = 5ZZ7W4SB26; + INFOPLIST_FILE = SimcoeExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimcoeExample.app/SimcoeExample"; + }; + name = Debug; + }; + 20C3B1CF1E5CE6F80095F185 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = 5ZZ7W4SB26; + INFOPLIST_FILE = SimcoeExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimcoeExample.app/SimcoeExample"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 20C3B1A81E5CE6F70095F185 /* Build configuration list for PBXProject "SimcoeExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 20C3B1C81E5CE6F80095F185 /* Debug */, + 20C3B1C91E5CE6F80095F185 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 20C3B1CA1E5CE6F80095F185 /* Build configuration list for PBXNativeTarget "SimcoeExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 20C3B1CB1E5CE6F80095F185 /* Debug */, + 20C3B1CC1E5CE6F80095F185 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 20C3B1CD1E5CE6F80095F185 /* Build configuration list for PBXNativeTarget "SimcoeExampleTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 20C3B1CE1E5CE6F80095F185 /* Debug */, + 20C3B1CF1E5CE6F80095F185 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 20C3B1A51E5CE6F70095F185 /* Project object */; +} diff --git a/SimcoeExample/SimcoeExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SimcoeExample/SimcoeExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..ffd30a0 --- /dev/null +++ b/SimcoeExample/SimcoeExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SimcoeExample/SimcoeExample.xcworkspace/contents.xcworkspacedata b/SimcoeExample/SimcoeExample.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..201dfbb --- /dev/null +++ b/SimcoeExample/SimcoeExample.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/SimcoeExample/SimcoeExample/AppDelegate.swift b/SimcoeExample/SimcoeExample/AppDelegate.swift new file mode 100644 index 0000000..48653b7 --- /dev/null +++ b/SimcoeExample/SimcoeExample/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/SimcoeExample/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/SimcoeExample/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..118c98f --- /dev/null +++ b/SimcoeExample/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SimcoeExample/SimcoeExample/Base.lproj/LaunchScreen.storyboard b/SimcoeExample/SimcoeExample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..fdf3f97 --- /dev/null +++ b/SimcoeExample/SimcoeExample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard b/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard new file mode 100644 index 0000000..273375f --- /dev/null +++ b/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimcoeExample/SimcoeExample/Info.plist b/SimcoeExample/SimcoeExample/Info.plist new file mode 100644 index 0000000..38e98af --- /dev/null +++ b/SimcoeExample/SimcoeExample/Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/SimcoeExample/SimcoeExample/ViewController.swift b/SimcoeExample/SimcoeExample/ViewController.swift new file mode 100644 index 0000000..c48bed4 --- /dev/null +++ b/SimcoeExample/SimcoeExample/ViewController.swift @@ -0,0 +1,25 @@ +// +// ViewController.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + +} + diff --git a/SimcoeExample/SimcoeExampleTests/Info.plist b/SimcoeExample/SimcoeExampleTests/Info.plist new file mode 100644 index 0000000..6c6c23c --- /dev/null +++ b/SimcoeExample/SimcoeExampleTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/SimcoeExample/SimcoeExampleTests/SimcoeExampleTests.swift b/SimcoeExample/SimcoeExampleTests/SimcoeExampleTests.swift new file mode 100644 index 0000000..6bfc97f --- /dev/null +++ b/SimcoeExample/SimcoeExampleTests/SimcoeExampleTests.swift @@ -0,0 +1,36 @@ +// +// SimcoeExampleTests.swift +// SimcoeExampleTests +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import XCTest +@testable import SimcoeExample + +class SimcoeExampleTests: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} From a1d3bf2d9394200d39af08260dea98b43c3365c9 Mon Sep 17 00:00:00 2001 From: Jonathan Samudio Date: Tue, 21 Feb 2017 16:29:09 -0500 Subject: [PATCH 02/11] Added simcoe example project. --- .../AnalyticsDisplayViewController.swift | 9 +++++++ .../SimcoeExample/ViewController.swift | 25 ------------------- 2 files changed, 9 insertions(+), 25 deletions(-) create mode 100644 SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift delete mode 100644 SimcoeExample/SimcoeExample/ViewController.swift diff --git a/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift b/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift new file mode 100644 index 0000000..665a5c1 --- /dev/null +++ b/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift @@ -0,0 +1,9 @@ +// +// AnalyticsDisplayViewController.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation diff --git a/SimcoeExample/SimcoeExample/ViewController.swift b/SimcoeExample/SimcoeExample/ViewController.swift deleted file mode 100644 index c48bed4..0000000 --- a/SimcoeExample/SimcoeExample/ViewController.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// ViewController.swift -// SimcoeExample -// -// Created by Jonathan Samudio on 2/21/17. -// Copyright © 2017 Prolific Interactive. All rights reserved. -// - -import UIKit - -class ViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - // Do any additional setup after loading the view, typically from a nib. - } - - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. - } - - -} - From 5d2a81613e0c329697207c95390b7f41dbcb9dc5 Mon Sep 17 00:00:00 2001 From: Jonathan Samudio Date: Tue, 21 Feb 2017 18:20:46 -0500 Subject: [PATCH 03/11] Added event action trackers and detail view controller. --- SimcoeExample/Podfile | 2 +- SimcoeExample/Podfile.lock | 18 ++- .../SimcoeExample.xcodeproj/project.pbxproj | 16 ++- .../AnalyticsDisplayViewController.swift | 131 +++++++++++++++++- .../SimcoeExample/Base.lproj/Main.storyboard | 54 ++++++-- .../SimcoeExample/Tracker.storyboard | 31 +++++ .../TrackerTableViewController.swift | 38 +++++ 7 files changed, 265 insertions(+), 25 deletions(-) create mode 100644 SimcoeExample/SimcoeExample/Tracker.storyboard create mode 100644 SimcoeExample/SimcoeExample/TrackerTableViewController.swift diff --git a/SimcoeExample/Podfile b/SimcoeExample/Podfile index 3b5d658..210752f 100644 --- a/SimcoeExample/Podfile +++ b/SimcoeExample/Podfile @@ -5,6 +5,6 @@ inhibit_all_warnings! target 'SimcoeExample’ do - pod 'Simcoe', :subspecs => ['Adobe', 'mParticle'] + pod 'Simcoe', :subspecs => ['Adobe', 'mParticle'], git: 'https://github.com/prolificinteractive/simcoe.git', branch: 'feature/swift3' end diff --git a/SimcoeExample/Podfile.lock b/SimcoeExample/Podfile.lock index b5ab869..2270a9c 100644 --- a/SimcoeExample/Podfile.lock +++ b/SimcoeExample/Podfile.lock @@ -14,14 +14,24 @@ PODS: - Simcoe/Core DEPENDENCIES: - - Simcoe/Adobe - - Simcoe/mParticle + - Simcoe/Adobe (from `https://github.com/prolificinteractive/simcoe.git`, branch `feature/swift3`) + - Simcoe/mParticle (from `https://github.com/prolificinteractive/simcoe.git`, branch `feature/swift3`) + +EXTERNAL SOURCES: + Simcoe: + :branch: feature/swift3 + :git: https://github.com/prolificinteractive/simcoe.git + +CHECKOUT OPTIONS: + Simcoe: + :commit: 136fdc0e7bcc6940c53fd54daff71ffd65c9afb6 + :git: https://github.com/prolificinteractive/simcoe.git SPEC CHECKSUMS: AdobeMobileSDK: 10bf49f2d5714b057615fbd9ade3ac2cfbff8316 mParticle-Apple-SDK: aa8648804e27986d1a7df36f222e93ef9cee2e9f - Simcoe: d640f0404f60167189f86175a5d9ca96092a1ad7 + Simcoe: 11fe674388e2f4c5b3f90090f165f5150b8aabb8 -PODFILE CHECKSUM: 580a39f57c913a79d766c549c729802bc4de85b8 +PODFILE CHECKSUM: 854f299f4e979b60279d6b865805f12ffa66d397 COCOAPODS: 1.1.1 diff --git a/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj b/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj index 1a64cd1..c56d03c 100644 --- a/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj +++ b/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj @@ -9,11 +9,13 @@ /* Begin PBXBuildFile section */ 17923EF38131CF03F54F6E9D /* Pods_SimcoeExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 431A5FFF8F112E2B83CCE282 /* Pods_SimcoeExample.framework */; }; 20C3B1B11E5CE6F70095F185 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */; }; - 20C3B1B31E5CE6F70095F185 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1B21E5CE6F70095F185 /* ViewController.swift */; }; 20C3B1B61E5CE6F70095F185 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B41E5CE6F70095F185 /* Main.storyboard */; }; 20C3B1B81E5CE6F70095F185 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */; }; 20C3B1BB1E5CE6F70095F185 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B91E5CE6F70095F185 /* LaunchScreen.storyboard */; }; 20C3B1C61E5CE6F80095F185 /* SimcoeExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1C51E5CE6F80095F185 /* SimcoeExampleTests.swift */; }; + 20C3B1D11E5CE7D70095F185 /* AnalyticsDisplayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1D01E5CE7D70095F185 /* AnalyticsDisplayViewController.swift */; }; + 20C3B1D31E5CED6C0095F185 /* TrackerTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1D21E5CED6C0095F185 /* TrackerTableViewController.swift */; }; + 20C3B1D51E5CEEB00095F185 /* Tracker.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1D41E5CEEB00095F185 /* Tracker.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -29,7 +31,6 @@ /* Begin PBXFileReference section */ 20C3B1AD1E5CE6F70095F185 /* SimcoeExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimcoeExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 20C3B1B21E5CE6F70095F185 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 20C3B1B51E5CE6F70095F185 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 20C3B1BA1E5CE6F70095F185 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -37,6 +38,9 @@ 20C3B1C11E5CE6F80095F185 /* SimcoeExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SimcoeExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 20C3B1C51E5CE6F80095F185 /* SimcoeExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimcoeExampleTests.swift; sourceTree = ""; }; 20C3B1C71E5CE6F80095F185 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 20C3B1D01E5CE7D70095F185 /* AnalyticsDisplayViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnalyticsDisplayViewController.swift; sourceTree = ""; }; + 20C3B1D21E5CED6C0095F185 /* TrackerTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrackerTableViewController.swift; sourceTree = ""; }; + 20C3B1D41E5CEEB00095F185 /* Tracker.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Tracker.storyboard; sourceTree = ""; }; 431A5FFF8F112E2B83CCE282 /* Pods_SimcoeExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SimcoeExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 6705DEBD5E0BA9CA1E336C0F /* Pods-SimcoeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SimcoeExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample.debug.xcconfig"; sourceTree = ""; }; 96D6CBE7E25C6571D36DD4FB /* Pods-SimcoeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SimcoeExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample.release.xcconfig"; sourceTree = ""; }; @@ -85,8 +89,10 @@ isa = PBXGroup; children = ( 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */, - 20C3B1B21E5CE6F70095F185 /* ViewController.swift */, + 20C3B1D01E5CE7D70095F185 /* AnalyticsDisplayViewController.swift */, + 20C3B1D21E5CED6C0095F185 /* TrackerTableViewController.swift */, 20C3B1B41E5CE6F70095F185 /* Main.storyboard */, + 20C3B1D41E5CEEB00095F185 /* Tracker.storyboard */, 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */, 20C3B1B91E5CE6F70095F185 /* LaunchScreen.storyboard */, 20C3B1BC1E5CE6F70095F185 /* Info.plist */, @@ -209,6 +215,7 @@ buildActionMask = 2147483647; files = ( 20C3B1BB1E5CE6F70095F185 /* LaunchScreen.storyboard in Resources */, + 20C3B1D51E5CEEB00095F185 /* Tracker.storyboard in Resources */, 20C3B1B81E5CE6F70095F185 /* Assets.xcassets in Resources */, 20C3B1B61E5CE6F70095F185 /* Main.storyboard in Resources */, ); @@ -276,7 +283,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 20C3B1B31E5CE6F70095F185 /* ViewController.swift in Sources */, + 20C3B1D31E5CED6C0095F185 /* TrackerTableViewController.swift in Sources */, + 20C3B1D11E5CE7D70095F185 /* AnalyticsDisplayViewController.swift in Sources */, 20C3B1B11E5CE6F70095F185 /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift b/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift index 665a5c1..1062f22 100644 --- a/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift +++ b/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift @@ -6,4 +6,133 @@ // Copyright © 2017 Prolific Interactive. All rights reserved. // -import Foundation +import UIKit +import Simcoe +import CoreLocation +import mParticle_Apple_SDK + +internal class AnalyticsTracker { + + var providers: [AnalyticsTracking] + + var actions: [TrackerAction] + + var name: String + + init(providers: [AnalyticsTracking], actions: [TrackerAction], name: String) { + self.providers = providers + self.actions = actions + self.name = name + } +} + +internal protocol TrackerAction { + + var name: String { get } + + func track() +} + +internal class EventTrackerAction: TrackerAction { + + var name: String { + return "Track Event" + } + + func track() { + var eventDataProperties: Properties = MPEvent.eventData(type: .other, name: "") + eventDataProperties["Location"] = "Tracker Page" + + Simcoe.track(event: "Tapped Track Event", withAdditionalProperties: eventDataProperties) + } +} + +internal class LifetimeValueIncreasingAction: TrackerAction { + + var name: String { + return "Track Lifetime Value Increase" + } + + func track() { + let properties: Properties = ["Location" : "Tracker Page"] + Simcoe.trackLifetimeIncrease(byAmount: 1, + forItem: "Track Lifetime Value Tapped", + withAdditionalProperties: properties) + } +} + +internal class LocationTrackingAction: TrackerAction { + + var name: String { + return "Track Location" + } + + func track() { + let properties: Properties = ["Location" : "Tracker Page"] + let location = CLLocation(latitude: 40.7128, longitude: 74.0059) + Simcoe.track(location: location, withAdditionalProperties: properties) + } +} + +internal class PageViewTrackingAction: TrackerAction { + + var name: String { + return "Track Page View" + } + + func track() { + let properties: Properties = ["Location" : "Tracker Page"] + Simcoe.track(pageView: "Tracker Selection Page View", withAdditionalProperties: properties) + } +} + +internal final class AnalyticsDisplayViewController: UITableViewController { + + var providers: [AnalyticsTracker] = [] + + override func viewDidLoad() { + super.viewDidLoad() + + let particle = mParticle(key: "ef79020ccbbfcf198717de75f0a406b4", secret: "0195e9e766b5b87aa2095d926f1d527e") + let adobe = Adobe() + + setupTrackers(providers: [adobe], name: adobe.name) + setupTrackers(providers: [particle], name: particle.name) + setupTrackers(providers: [adobe, particle], name: "All Analytics Trackers") + setupTrackers(providers: [], name: "None") + } + + private func setupTrackers(providers: [AnalyticsTracking], name: String) { + let actions: [TrackerAction] = [EventTrackerAction(), + LocationTrackingAction(), + LifetimeValueIncreasingAction(), + PageViewTrackingAction()] + + self.providers.append(AnalyticsTracker(providers: providers, actions: actions, name: name)) + } +} + +extension AnalyticsDisplayViewController { + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return providers.count + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = UITableViewCell() + cell.textLabel?.text = providers[indexPath.row].name + cell.accessoryType = .disclosureIndicator + return cell + } + + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + + let trackerVC = TrackerTableViewController.storyboardInit() + + Simcoe.run(with: providers[indexPath.row].providers) + + trackerVC.trackers = providers[indexPath.row].actions + navigationController?.pushViewController(trackerVC, animated: true) + } +} diff --git a/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard b/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard index 273375f..4f9e1f7 100644 --- a/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard +++ b/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard @@ -1,26 +1,50 @@ - - + + + + + - + + - - + + - - - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimcoeExample/SimcoeExample/Tracker.storyboard b/SimcoeExample/SimcoeExample/Tracker.storyboard new file mode 100644 index 0000000..1828a24 --- /dev/null +++ b/SimcoeExample/SimcoeExample/Tracker.storyboard @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimcoeExample/SimcoeExample/TrackerTableViewController.swift b/SimcoeExample/SimcoeExample/TrackerTableViewController.swift new file mode 100644 index 0000000..ba16a0f --- /dev/null +++ b/SimcoeExample/SimcoeExample/TrackerTableViewController.swift @@ -0,0 +1,38 @@ +// +// TrackerTableViewController.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import UIKit +import Simcoe + +internal final class TrackerTableViewController: UITableViewController { + + var trackers: [TrackerAction]! + + static func storyboardInit() -> TrackerTableViewController { + let storyBoard = UIStoryboard(name: "Tracker", bundle: nil) + return storyBoard.instantiateViewController(withIdentifier: "TrackerTableViewController") as! TrackerTableViewController + } +} + +extension TrackerTableViewController { + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return trackers.count + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = UITableViewCell() + cell.textLabel?.text = trackers[indexPath.row].name + return cell + } + + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + trackers[indexPath.row].track() + } +} From a991e875165e48fb99dfde9c19f149ffc309015b Mon Sep 17 00:00:00 2001 From: Jonathan Samudio Date: Tue, 21 Feb 2017 18:47:42 -0500 Subject: [PATCH 04/11] Moved simcoe example to the main workspace. --- Podfile | 4 +- Podfile.lock | 4 +- Simcoe.xcworkspace/contents.xcworkspacedata | 2 +- .../SimcoeExample.xcodeproj/project.pbxproj | 24 +- {SimcoeExample => SimcoeExample2}/Podfile | 0 .../Podfile.lock | 0 .../SimcoeExample.xcodeproj/project.pbxproj | 512 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../contents.xcworkspacedata | 0 .../AnalyticsDisplayViewController.swift | 138 +++++ .../SimcoeExample/AppDelegate.swift | 46 ++ .../AppIcon.appiconset/Contents.json | 38 ++ .../Base.lproj/LaunchScreen.storyboard | 27 + .../SimcoeExample/Base.lproj/Main.storyboard | 50 ++ SimcoeExample2/SimcoeExample/Info.plist | 38 ++ .../SimcoeExample/Tracker.storyboard | 31 ++ .../TrackerTableViewController.swift | 38 ++ SimcoeExample2/SimcoeExampleTests/Info.plist | 22 + .../SimcoeExampleTests.swift | 36 ++ .../SimcoeExample.xcodeproj/project.pbxproj | 382 +++++++++++++ .../AnalyticsDisplayViewController.swift | 138 +++++ .../SimcoeExample/AppDelegate.swift | 46 ++ .../AppIcon.appiconset/Contents.json | 38 ++ .../Base.lproj/LaunchScreen.storyboard | 27 + .../SimcoeExample/Base.lproj/Main.storyboard | 50 ++ .../SimcoeExample/SimcoeExample/Info.plist | 38 ++ .../SimcoeExample/Tracker.storyboard | 31 ++ .../TrackerTableViewController.swift | 38 ++ .../SimcoeExampleTests/Info.plist | 22 + .../SimcoeExampleTests.swift | 36 ++ .../project.pbxproj | 383 ------------- .../xcschemes/mParticleExample.xcscheme | 91 ---- 32 files changed, 1846 insertions(+), 491 deletions(-) rename {SimcoeExample => SimcoeExample2}/Podfile (100%) rename {SimcoeExample => SimcoeExample2}/Podfile.lock (100%) create mode 100644 SimcoeExample2/SimcoeExample.xcodeproj/project.pbxproj create mode 100644 SimcoeExample2/SimcoeExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename {SimcoeExample => SimcoeExample2}/SimcoeExample.xcworkspace/contents.xcworkspacedata (100%) create mode 100644 SimcoeExample2/SimcoeExample/AnalyticsDisplayViewController.swift create mode 100644 SimcoeExample2/SimcoeExample/AppDelegate.swift create mode 100644 SimcoeExample2/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 SimcoeExample2/SimcoeExample/Base.lproj/LaunchScreen.storyboard create mode 100644 SimcoeExample2/SimcoeExample/Base.lproj/Main.storyboard create mode 100644 SimcoeExample2/SimcoeExample/Info.plist create mode 100644 SimcoeExample2/SimcoeExample/Tracker.storyboard create mode 100644 SimcoeExample2/SimcoeExample/TrackerTableViewController.swift create mode 100644 SimcoeExample2/SimcoeExampleTests/Info.plist create mode 100644 SimcoeExample2/SimcoeExampleTests/SimcoeExampleTests.swift create mode 100644 SimcoeExample3/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj create mode 100644 SimcoeExample3/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift create mode 100644 SimcoeExample3/SimcoeExample/SimcoeExample/AppDelegate.swift create mode 100644 SimcoeExample3/SimcoeExample/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 SimcoeExample3/SimcoeExample/SimcoeExample/Base.lproj/LaunchScreen.storyboard create mode 100644 SimcoeExample3/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard create mode 100644 SimcoeExample3/SimcoeExample/SimcoeExample/Info.plist create mode 100644 SimcoeExample3/SimcoeExample/SimcoeExample/Tracker.storyboard create mode 100644 SimcoeExample3/SimcoeExample/SimcoeExample/TrackerTableViewController.swift create mode 100644 SimcoeExample3/SimcoeExample/SimcoeExampleTests/Info.plist create mode 100644 SimcoeExample3/SimcoeExample/SimcoeExampleTests/SimcoeExampleTests.swift delete mode 100644 mParticleExample/mParticleExample.xcodeproj/project.pbxproj delete mode 100644 mParticleExample/mParticleExample.xcodeproj/xcshareddata/xcschemes/mParticleExample.xcscheme diff --git a/Podfile b/Podfile index ba8c074..36fe9da 100644 --- a/Podfile +++ b/Podfile @@ -16,8 +16,8 @@ target 'Simcoe' do end -target 'mParticleExample' do - project 'mParticleExample/mParticleExample' +target 'SimcoeExample' do + project 'SimcoeExample/SimcoeExample' pod 'Simcoe', :path => './', :subspecs => ['Adobe', 'mParticle'] podspec :path => 'Simcoe.podspec' diff --git a/Podfile.lock b/Podfile.lock index b82e326..d1fe53a 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -21,13 +21,13 @@ DEPENDENCIES: EXTERNAL SOURCES: Simcoe: - :path: "./" + :path: ./ SPEC CHECKSUMS: AdobeMobileSDK: 52c3fbf43b5b054132393b1486ecbefca0ba01db mParticle-Apple-SDK: 8c7dfc195459870aa33be634f006342cb37d6a24 Simcoe: 11fe674388e2f4c5b3f90090f165f5150b8aabb8 -PODFILE CHECKSUM: eca652a10d5483dbc0b33408738dd00362f29b2c +PODFILE CHECKSUM: 501664c76426d2cb9e5d6bac65a1b3138e7f43cb COCOAPODS: 1.1.1 diff --git a/Simcoe.xcworkspace/contents.xcworkspacedata b/Simcoe.xcworkspace/contents.xcworkspacedata index f75aa4f..bff6263 100644 --- a/Simcoe.xcworkspace/contents.xcworkspacedata +++ b/Simcoe.xcworkspace/contents.xcworkspacedata @@ -5,7 +5,7 @@ location = "group:Simcoe.xcodeproj"> + location = "group:SimcoeExample/SimcoeExample.xcodeproj"> diff --git a/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj b/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj index c56d03c..43f804e 100644 --- a/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj +++ b/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 17923EF38131CF03F54F6E9D /* Pods_SimcoeExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 431A5FFF8F112E2B83CCE282 /* Pods_SimcoeExample.framework */; }; 20C3B1B11E5CE6F70095F185 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */; }; 20C3B1B61E5CE6F70095F185 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B41E5CE6F70095F185 /* Main.storyboard */; }; 20C3B1B81E5CE6F70095F185 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */; }; @@ -16,6 +15,7 @@ 20C3B1D11E5CE7D70095F185 /* AnalyticsDisplayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1D01E5CE7D70095F185 /* AnalyticsDisplayViewController.swift */; }; 20C3B1D31E5CED6C0095F185 /* TrackerTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1D21E5CED6C0095F185 /* TrackerTableViewController.swift */; }; 20C3B1D51E5CEEB00095F185 /* Tracker.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1D41E5CEEB00095F185 /* Tracker.storyboard */; }; + 7C053332C270E8F7722BCEC4 /* Pods_SimcoeExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CD57B97C112AB0B5961BA41 /* Pods_SimcoeExample.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -41,9 +41,9 @@ 20C3B1D01E5CE7D70095F185 /* AnalyticsDisplayViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnalyticsDisplayViewController.swift; sourceTree = ""; }; 20C3B1D21E5CED6C0095F185 /* TrackerTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrackerTableViewController.swift; sourceTree = ""; }; 20C3B1D41E5CEEB00095F185 /* Tracker.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Tracker.storyboard; sourceTree = ""; }; - 431A5FFF8F112E2B83CCE282 /* Pods_SimcoeExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SimcoeExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 6705DEBD5E0BA9CA1E336C0F /* Pods-SimcoeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SimcoeExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample.debug.xcconfig"; sourceTree = ""; }; - 96D6CBE7E25C6571D36DD4FB /* Pods-SimcoeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SimcoeExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample.release.xcconfig"; sourceTree = ""; }; + 2CD57B97C112AB0B5961BA41 /* Pods_SimcoeExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SimcoeExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E83548EECC7ED7DF5F36D714 /* Pods-SimcoeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SimcoeExample.release.xcconfig"; path = "../Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample.release.xcconfig"; sourceTree = ""; }; + E91AED01048FDD61337E822D /* Pods-SimcoeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SimcoeExample.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -51,7 +51,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 17923EF38131CF03F54F6E9D /* Pods_SimcoeExample.framework in Frameworks */, + 7C053332C270E8F7722BCEC4 /* Pods_SimcoeExample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -112,8 +112,8 @@ C7C320D69EA0D1C563FF3995 /* Pods */ = { isa = PBXGroup; children = ( - 6705DEBD5E0BA9CA1E336C0F /* Pods-SimcoeExample.debug.xcconfig */, - 96D6CBE7E25C6571D36DD4FB /* Pods-SimcoeExample.release.xcconfig */, + E91AED01048FDD61337E822D /* Pods-SimcoeExample.debug.xcconfig */, + E83548EECC7ED7DF5F36D714 /* Pods-SimcoeExample.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -121,7 +121,7 @@ F9408D272EA2E6886CDC6D26 /* Frameworks */ = { isa = PBXGroup; children = ( - 431A5FFF8F112E2B83CCE282 /* Pods_SimcoeExample.framework */, + 2CD57B97C112AB0B5961BA41 /* Pods_SimcoeExample.framework */, ); name = Frameworks; sourceTree = ""; @@ -243,7 +243,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample-resources.sh\"\n"; showEnvVarsInLog = 0; }; 8ACB246C83C58B83E0AEBFF0 /* [CP] Embed Pods Frameworks */ = { @@ -258,7 +258,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; F6BE0E261E5827888F00C654 /* [CP] Check Pods Manifest.lock */ = { @@ -420,7 +420,7 @@ }; 20C3B1CB1E5CE6F80095F185 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 6705DEBD5E0BA9CA1E336C0F /* Pods-SimcoeExample.debug.xcconfig */; + baseConfigurationReference = E91AED01048FDD61337E822D /* Pods-SimcoeExample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = 5ZZ7W4SB26; @@ -434,7 +434,7 @@ }; 20C3B1CC1E5CE6F80095F185 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 96D6CBE7E25C6571D36DD4FB /* Pods-SimcoeExample.release.xcconfig */; + baseConfigurationReference = E83548EECC7ED7DF5F36D714 /* Pods-SimcoeExample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = 5ZZ7W4SB26; diff --git a/SimcoeExample/Podfile b/SimcoeExample2/Podfile similarity index 100% rename from SimcoeExample/Podfile rename to SimcoeExample2/Podfile diff --git a/SimcoeExample/Podfile.lock b/SimcoeExample2/Podfile.lock similarity index 100% rename from SimcoeExample/Podfile.lock rename to SimcoeExample2/Podfile.lock diff --git a/SimcoeExample2/SimcoeExample.xcodeproj/project.pbxproj b/SimcoeExample2/SimcoeExample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..6d5af93 --- /dev/null +++ b/SimcoeExample2/SimcoeExample.xcodeproj/project.pbxproj @@ -0,0 +1,512 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 17923EF38131CF03F54F6E9D /* Pods_SimcoeExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 431A5FFF8F112E2B83CCE282 /* Pods_SimcoeExample.framework */; }; + 20C3B1B11E5CE6F70095F185 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */; }; + 20C3B1B61E5CE6F70095F185 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B41E5CE6F70095F185 /* Main.storyboard */; }; + 20C3B1B81E5CE6F70095F185 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */; }; + 20C3B1BB1E5CE6F70095F185 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B91E5CE6F70095F185 /* LaunchScreen.storyboard */; }; + 20C3B1C61E5CE6F80095F185 /* SimcoeExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1C51E5CE6F80095F185 /* SimcoeExampleTests.swift */; }; + 20C3B1D11E5CE7D70095F185 /* AnalyticsDisplayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1D01E5CE7D70095F185 /* AnalyticsDisplayViewController.swift */; }; + 20C3B1D31E5CED6C0095F185 /* TrackerTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1D21E5CED6C0095F185 /* TrackerTableViewController.swift */; }; + 20C3B1D51E5CEEB00095F185 /* Tracker.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1D41E5CEEB00095F185 /* Tracker.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 20C3B1C21E5CE6F80095F185 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 20C3B1A51E5CE6F70095F185 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 20C3B1AC1E5CE6F70095F185; + remoteInfo = SimcoeExample; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 20C3B1AD1E5CE6F70095F185 /* SimcoeExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimcoeExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 20C3B1B51E5CE6F70095F185 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 20C3B1BA1E5CE6F70095F185 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 20C3B1BC1E5CE6F70095F185 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 20C3B1C11E5CE6F80095F185 /* SimcoeExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SimcoeExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 20C3B1C51E5CE6F80095F185 /* SimcoeExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimcoeExampleTests.swift; sourceTree = ""; }; + 20C3B1C71E5CE6F80095F185 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 20C3B1D01E5CE7D70095F185 /* AnalyticsDisplayViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnalyticsDisplayViewController.swift; sourceTree = ""; }; + 20C3B1D21E5CED6C0095F185 /* TrackerTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrackerTableViewController.swift; sourceTree = ""; }; + 20C3B1D41E5CEEB00095F185 /* Tracker.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Tracker.storyboard; sourceTree = ""; }; + 431A5FFF8F112E2B83CCE282 /* Pods_SimcoeExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SimcoeExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6705DEBD5E0BA9CA1E336C0F /* Pods-SimcoeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SimcoeExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample.debug.xcconfig"; sourceTree = ""; }; + 96D6CBE7E25C6571D36DD4FB /* Pods-SimcoeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SimcoeExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 20C3B1AA1E5CE6F70095F185 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 17923EF38131CF03F54F6E9D /* Pods_SimcoeExample.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 20C3B1BE1E5CE6F80095F185 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 20C3B1A41E5CE6F70095F185 = { + isa = PBXGroup; + children = ( + 20C3B1AF1E5CE6F70095F185 /* SimcoeExample */, + 20C3B1C41E5CE6F80095F185 /* SimcoeExampleTests */, + 20C3B1AE1E5CE6F70095F185 /* Products */, + C7C320D69EA0D1C563FF3995 /* Pods */, + F9408D272EA2E6886CDC6D26 /* Frameworks */, + ); + sourceTree = ""; + }; + 20C3B1AE1E5CE6F70095F185 /* Products */ = { + isa = PBXGroup; + children = ( + 20C3B1AD1E5CE6F70095F185 /* SimcoeExample.app */, + 20C3B1C11E5CE6F80095F185 /* SimcoeExampleTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 20C3B1AF1E5CE6F70095F185 /* SimcoeExample */ = { + isa = PBXGroup; + children = ( + 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */, + 20C3B1D01E5CE7D70095F185 /* AnalyticsDisplayViewController.swift */, + 20C3B1D21E5CED6C0095F185 /* TrackerTableViewController.swift */, + 20C3B1B41E5CE6F70095F185 /* Main.storyboard */, + 20C3B1D41E5CEEB00095F185 /* Tracker.storyboard */, + 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */, + 20C3B1B91E5CE6F70095F185 /* LaunchScreen.storyboard */, + 20C3B1BC1E5CE6F70095F185 /* Info.plist */, + ); + path = SimcoeExample; + sourceTree = ""; + }; + 20C3B1C41E5CE6F80095F185 /* SimcoeExampleTests */ = { + isa = PBXGroup; + children = ( + 20C3B1C51E5CE6F80095F185 /* SimcoeExampleTests.swift */, + 20C3B1C71E5CE6F80095F185 /* Info.plist */, + ); + path = SimcoeExampleTests; + sourceTree = ""; + }; + C7C320D69EA0D1C563FF3995 /* Pods */ = { + isa = PBXGroup; + children = ( + 6705DEBD5E0BA9CA1E336C0F /* Pods-SimcoeExample.debug.xcconfig */, + 96D6CBE7E25C6571D36DD4FB /* Pods-SimcoeExample.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + F9408D272EA2E6886CDC6D26 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 431A5FFF8F112E2B83CCE282 /* Pods_SimcoeExample.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 20C3B1AC1E5CE6F70095F185 /* SimcoeExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 20C3B1CA1E5CE6F80095F185 /* Build configuration list for PBXNativeTarget "SimcoeExample" */; + buildPhases = ( + F6BE0E261E5827888F00C654 /* [CP] Check Pods Manifest.lock */, + 20C3B1A91E5CE6F70095F185 /* Sources */, + 20C3B1AA1E5CE6F70095F185 /* Frameworks */, + 20C3B1AB1E5CE6F70095F185 /* Resources */, + 8ACB246C83C58B83E0AEBFF0 /* [CP] Embed Pods Frameworks */, + 46EA684A0296F94B24CD361E /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SimcoeExample; + productName = SimcoeExample; + productReference = 20C3B1AD1E5CE6F70095F185 /* SimcoeExample.app */; + productType = "com.apple.product-type.application"; + }; + 20C3B1C01E5CE6F80095F185 /* SimcoeExampleTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 20C3B1CD1E5CE6F80095F185 /* Build configuration list for PBXNativeTarget "SimcoeExampleTests" */; + buildPhases = ( + 20C3B1BD1E5CE6F80095F185 /* Sources */, + 20C3B1BE1E5CE6F80095F185 /* Frameworks */, + 20C3B1BF1E5CE6F80095F185 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 20C3B1C31E5CE6F80095F185 /* PBXTargetDependency */, + ); + name = SimcoeExampleTests; + productName = SimcoeExampleTests; + productReference = 20C3B1C11E5CE6F80095F185 /* SimcoeExampleTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 20C3B1A51E5CE6F70095F185 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0820; + LastUpgradeCheck = 0820; + ORGANIZATIONNAME = "Prolific Interactive"; + TargetAttributes = { + 20C3B1AC1E5CE6F70095F185 = { + CreatedOnToolsVersion = 8.2.1; + DevelopmentTeam = 5ZZ7W4SB26; + ProvisioningStyle = Automatic; + }; + 20C3B1C01E5CE6F80095F185 = { + CreatedOnToolsVersion = 8.2.1; + DevelopmentTeam = 5ZZ7W4SB26; + ProvisioningStyle = Automatic; + TestTargetID = 20C3B1AC1E5CE6F70095F185; + }; + }; + }; + buildConfigurationList = 20C3B1A81E5CE6F70095F185 /* Build configuration list for PBXProject "SimcoeExample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 20C3B1A41E5CE6F70095F185; + productRefGroup = 20C3B1AE1E5CE6F70095F185 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 20C3B1AC1E5CE6F70095F185 /* SimcoeExample */, + 20C3B1C01E5CE6F80095F185 /* SimcoeExampleTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 20C3B1AB1E5CE6F70095F185 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 20C3B1BB1E5CE6F70095F185 /* LaunchScreen.storyboard in Resources */, + 20C3B1D51E5CEEB00095F185 /* Tracker.storyboard in Resources */, + 20C3B1B81E5CE6F70095F185 /* Assets.xcassets in Resources */, + 20C3B1B61E5CE6F70095F185 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 20C3B1BF1E5CE6F80095F185 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 46EA684A0296F94B24CD361E /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 8ACB246C83C58B83E0AEBFF0 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-SimcoeExample/Pods-SimcoeExample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + F6BE0E261E5827888F00C654 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../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"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 20C3B1A91E5CE6F70095F185 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 20C3B1D31E5CED6C0095F185 /* TrackerTableViewController.swift in Sources */, + 20C3B1D11E5CE7D70095F185 /* AnalyticsDisplayViewController.swift in Sources */, + 20C3B1B11E5CE6F70095F185 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 20C3B1BD1E5CE6F80095F185 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 20C3B1C61E5CE6F80095F185 /* SimcoeExampleTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 20C3B1C31E5CE6F80095F185 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 20C3B1AC1E5CE6F70095F185 /* SimcoeExample */; + targetProxy = 20C3B1C21E5CE6F80095F185 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 20C3B1B41E5CE6F70095F185 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 20C3B1B51E5CE6F70095F185 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 20C3B1B91E5CE6F70095F185 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 20C3B1BA1E5CE6F70095F185 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 20C3B1C81E5CE6F80095F185 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 20C3B1C91E5CE6F80095F185 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 20C3B1CB1E5CE6F80095F185 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6705DEBD5E0BA9CA1E336C0F /* Pods-SimcoeExample.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 5ZZ7W4SB26; + INFOPLIST_FILE = SimcoeExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 20C3B1CC1E5CE6F80095F185 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 96D6CBE7E25C6571D36DD4FB /* Pods-SimcoeExample.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 5ZZ7W4SB26; + INFOPLIST_FILE = SimcoeExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + 20C3B1CE1E5CE6F80095F185 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = 5ZZ7W4SB26; + INFOPLIST_FILE = SimcoeExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimcoeExample.app/SimcoeExample"; + }; + name = Debug; + }; + 20C3B1CF1E5CE6F80095F185 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = 5ZZ7W4SB26; + INFOPLIST_FILE = SimcoeExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimcoeExample.app/SimcoeExample"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 20C3B1A81E5CE6F70095F185 /* Build configuration list for PBXProject "SimcoeExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 20C3B1C81E5CE6F80095F185 /* Debug */, + 20C3B1C91E5CE6F80095F185 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 20C3B1CA1E5CE6F80095F185 /* Build configuration list for PBXNativeTarget "SimcoeExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 20C3B1CB1E5CE6F80095F185 /* Debug */, + 20C3B1CC1E5CE6F80095F185 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 20C3B1CD1E5CE6F80095F185 /* Build configuration list for PBXNativeTarget "SimcoeExampleTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 20C3B1CE1E5CE6F80095F185 /* Debug */, + 20C3B1CF1E5CE6F80095F185 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 20C3B1A51E5CE6F70095F185 /* Project object */; +} diff --git a/SimcoeExample2/SimcoeExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SimcoeExample2/SimcoeExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..ffd30a0 --- /dev/null +++ b/SimcoeExample2/SimcoeExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SimcoeExample/SimcoeExample.xcworkspace/contents.xcworkspacedata b/SimcoeExample2/SimcoeExample.xcworkspace/contents.xcworkspacedata similarity index 100% rename from SimcoeExample/SimcoeExample.xcworkspace/contents.xcworkspacedata rename to SimcoeExample2/SimcoeExample.xcworkspace/contents.xcworkspacedata diff --git a/SimcoeExample2/SimcoeExample/AnalyticsDisplayViewController.swift b/SimcoeExample2/SimcoeExample/AnalyticsDisplayViewController.swift new file mode 100644 index 0000000..1062f22 --- /dev/null +++ b/SimcoeExample2/SimcoeExample/AnalyticsDisplayViewController.swift @@ -0,0 +1,138 @@ +// +// AnalyticsDisplayViewController.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import UIKit +import Simcoe +import CoreLocation +import mParticle_Apple_SDK + +internal class AnalyticsTracker { + + var providers: [AnalyticsTracking] + + var actions: [TrackerAction] + + var name: String + + init(providers: [AnalyticsTracking], actions: [TrackerAction], name: String) { + self.providers = providers + self.actions = actions + self.name = name + } +} + +internal protocol TrackerAction { + + var name: String { get } + + func track() +} + +internal class EventTrackerAction: TrackerAction { + + var name: String { + return "Track Event" + } + + func track() { + var eventDataProperties: Properties = MPEvent.eventData(type: .other, name: "") + eventDataProperties["Location"] = "Tracker Page" + + Simcoe.track(event: "Tapped Track Event", withAdditionalProperties: eventDataProperties) + } +} + +internal class LifetimeValueIncreasingAction: TrackerAction { + + var name: String { + return "Track Lifetime Value Increase" + } + + func track() { + let properties: Properties = ["Location" : "Tracker Page"] + Simcoe.trackLifetimeIncrease(byAmount: 1, + forItem: "Track Lifetime Value Tapped", + withAdditionalProperties: properties) + } +} + +internal class LocationTrackingAction: TrackerAction { + + var name: String { + return "Track Location" + } + + func track() { + let properties: Properties = ["Location" : "Tracker Page"] + let location = CLLocation(latitude: 40.7128, longitude: 74.0059) + Simcoe.track(location: location, withAdditionalProperties: properties) + } +} + +internal class PageViewTrackingAction: TrackerAction { + + var name: String { + return "Track Page View" + } + + func track() { + let properties: Properties = ["Location" : "Tracker Page"] + Simcoe.track(pageView: "Tracker Selection Page View", withAdditionalProperties: properties) + } +} + +internal final class AnalyticsDisplayViewController: UITableViewController { + + var providers: [AnalyticsTracker] = [] + + override func viewDidLoad() { + super.viewDidLoad() + + let particle = mParticle(key: "ef79020ccbbfcf198717de75f0a406b4", secret: "0195e9e766b5b87aa2095d926f1d527e") + let adobe = Adobe() + + setupTrackers(providers: [adobe], name: adobe.name) + setupTrackers(providers: [particle], name: particle.name) + setupTrackers(providers: [adobe, particle], name: "All Analytics Trackers") + setupTrackers(providers: [], name: "None") + } + + private func setupTrackers(providers: [AnalyticsTracking], name: String) { + let actions: [TrackerAction] = [EventTrackerAction(), + LocationTrackingAction(), + LifetimeValueIncreasingAction(), + PageViewTrackingAction()] + + self.providers.append(AnalyticsTracker(providers: providers, actions: actions, name: name)) + } +} + +extension AnalyticsDisplayViewController { + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return providers.count + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = UITableViewCell() + cell.textLabel?.text = providers[indexPath.row].name + cell.accessoryType = .disclosureIndicator + return cell + } + + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + + let trackerVC = TrackerTableViewController.storyboardInit() + + Simcoe.run(with: providers[indexPath.row].providers) + + trackerVC.trackers = providers[indexPath.row].actions + navigationController?.pushViewController(trackerVC, animated: true) + } +} diff --git a/SimcoeExample2/SimcoeExample/AppDelegate.swift b/SimcoeExample2/SimcoeExample/AppDelegate.swift new file mode 100644 index 0000000..48653b7 --- /dev/null +++ b/SimcoeExample2/SimcoeExample/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/SimcoeExample2/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/SimcoeExample2/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..118c98f --- /dev/null +++ b/SimcoeExample2/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SimcoeExample2/SimcoeExample/Base.lproj/LaunchScreen.storyboard b/SimcoeExample2/SimcoeExample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..fdf3f97 --- /dev/null +++ b/SimcoeExample2/SimcoeExample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimcoeExample2/SimcoeExample/Base.lproj/Main.storyboard b/SimcoeExample2/SimcoeExample/Base.lproj/Main.storyboard new file mode 100644 index 0000000..4f9e1f7 --- /dev/null +++ b/SimcoeExample2/SimcoeExample/Base.lproj/Main.storyboard @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimcoeExample2/SimcoeExample/Info.plist b/SimcoeExample2/SimcoeExample/Info.plist new file mode 100644 index 0000000..38e98af --- /dev/null +++ b/SimcoeExample2/SimcoeExample/Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/SimcoeExample2/SimcoeExample/Tracker.storyboard b/SimcoeExample2/SimcoeExample/Tracker.storyboard new file mode 100644 index 0000000..1828a24 --- /dev/null +++ b/SimcoeExample2/SimcoeExample/Tracker.storyboard @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimcoeExample2/SimcoeExample/TrackerTableViewController.swift b/SimcoeExample2/SimcoeExample/TrackerTableViewController.swift new file mode 100644 index 0000000..ba16a0f --- /dev/null +++ b/SimcoeExample2/SimcoeExample/TrackerTableViewController.swift @@ -0,0 +1,38 @@ +// +// TrackerTableViewController.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import UIKit +import Simcoe + +internal final class TrackerTableViewController: UITableViewController { + + var trackers: [TrackerAction]! + + static func storyboardInit() -> TrackerTableViewController { + let storyBoard = UIStoryboard(name: "Tracker", bundle: nil) + return storyBoard.instantiateViewController(withIdentifier: "TrackerTableViewController") as! TrackerTableViewController + } +} + +extension TrackerTableViewController { + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return trackers.count + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = UITableViewCell() + cell.textLabel?.text = trackers[indexPath.row].name + return cell + } + + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + trackers[indexPath.row].track() + } +} diff --git a/SimcoeExample2/SimcoeExampleTests/Info.plist b/SimcoeExample2/SimcoeExampleTests/Info.plist new file mode 100644 index 0000000..6c6c23c --- /dev/null +++ b/SimcoeExample2/SimcoeExampleTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/SimcoeExample2/SimcoeExampleTests/SimcoeExampleTests.swift b/SimcoeExample2/SimcoeExampleTests/SimcoeExampleTests.swift new file mode 100644 index 0000000..6bfc97f --- /dev/null +++ b/SimcoeExample2/SimcoeExampleTests/SimcoeExampleTests.swift @@ -0,0 +1,36 @@ +// +// SimcoeExampleTests.swift +// SimcoeExampleTests +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import XCTest +@testable import SimcoeExample + +class SimcoeExampleTests: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/SimcoeExample3/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj b/SimcoeExample3/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c002ba1 --- /dev/null +++ b/SimcoeExample3/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj @@ -0,0 +1,382 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 200562CA1E5D07750015AD55 /* SimcoeExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562C91E5D07750015AD55 /* SimcoeExampleTests.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 200562C61E5D07750015AD55 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 200562A91E5D07750015AD55 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 200562B01E5D07750015AD55; + remoteInfo = SimcoeExample; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 200562B11E5D07750015AD55 /* SimcoeExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimcoeExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 200562C51E5D07750015AD55 /* SimcoeExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SimcoeExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 200562C91E5D07750015AD55 /* SimcoeExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimcoeExampleTests.swift; sourceTree = ""; }; + 200562CB1E5D07750015AD55 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 200562AE1E5D07750015AD55 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 200562C21E5D07750015AD55 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 200562A81E5D07750015AD55 = { + isa = PBXGroup; + children = ( + 200562B31E5D07750015AD55 /* SimcoeExample */, + 200562C81E5D07750015AD55 /* SimcoeExampleTests */, + 200562B21E5D07750015AD55 /* Products */, + ); + sourceTree = ""; + }; + 200562B21E5D07750015AD55 /* Products */ = { + isa = PBXGroup; + children = ( + 200562B11E5D07750015AD55 /* SimcoeExample.app */, + 200562C51E5D07750015AD55 /* SimcoeExampleTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 200562B31E5D07750015AD55 /* SimcoeExample */ = { + isa = PBXGroup; + children = ( + ); + path = SimcoeExample; + sourceTree = ""; + }; + 200562C81E5D07750015AD55 /* SimcoeExampleTests */ = { + isa = PBXGroup; + children = ( + 200562C91E5D07750015AD55 /* SimcoeExampleTests.swift */, + 200562CB1E5D07750015AD55 /* Info.plist */, + ); + path = SimcoeExampleTests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 200562B01E5D07750015AD55 /* SimcoeExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 200562CE1E5D07750015AD55 /* Build configuration list for PBXNativeTarget "SimcoeExample" */; + buildPhases = ( + 200562AD1E5D07750015AD55 /* Sources */, + 200562AE1E5D07750015AD55 /* Frameworks */, + 200562AF1E5D07750015AD55 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SimcoeExample; + productName = SimcoeExample; + productReference = 200562B11E5D07750015AD55 /* SimcoeExample.app */; + productType = "com.apple.product-type.application"; + }; + 200562C41E5D07750015AD55 /* SimcoeExampleTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 200562D11E5D07750015AD55 /* Build configuration list for PBXNativeTarget "SimcoeExampleTests" */; + buildPhases = ( + 200562C11E5D07750015AD55 /* Sources */, + 200562C21E5D07750015AD55 /* Frameworks */, + 200562C31E5D07750015AD55 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 200562C71E5D07750015AD55 /* PBXTargetDependency */, + ); + name = SimcoeExampleTests; + productName = SimcoeExampleTests; + productReference = 200562C51E5D07750015AD55 /* SimcoeExampleTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 200562A91E5D07750015AD55 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0820; + LastUpgradeCheck = 0820; + ORGANIZATIONNAME = "Prolific Interactive"; + TargetAttributes = { + 200562B01E5D07750015AD55 = { + CreatedOnToolsVersion = 8.2.1; + DevelopmentTeam = 5ZZ7W4SB26; + ProvisioningStyle = Automatic; + }; + 200562C41E5D07750015AD55 = { + CreatedOnToolsVersion = 8.2.1; + DevelopmentTeam = 5ZZ7W4SB26; + ProvisioningStyle = Automatic; + TestTargetID = 200562B01E5D07750015AD55; + }; + }; + }; + buildConfigurationList = 200562AC1E5D07750015AD55 /* Build configuration list for PBXProject "SimcoeExample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 200562A81E5D07750015AD55; + productRefGroup = 200562B21E5D07750015AD55 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 200562B01E5D07750015AD55 /* SimcoeExample */, + 200562C41E5D07750015AD55 /* SimcoeExampleTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 200562AF1E5D07750015AD55 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 200562C31E5D07750015AD55 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 200562AD1E5D07750015AD55 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 200562C11E5D07750015AD55 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 200562CA1E5D07750015AD55 /* SimcoeExampleTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 200562C71E5D07750015AD55 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 200562B01E5D07750015AD55 /* SimcoeExample */; + targetProxy = 200562C61E5D07750015AD55 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 200562CC1E5D07750015AD55 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 200562CD1E5D07750015AD55 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 200562CF1E5D07750015AD55 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 5ZZ7W4SB26; + INFOPLIST_FILE = SimcoeExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 200562D01E5D07750015AD55 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 5ZZ7W4SB26; + INFOPLIST_FILE = SimcoeExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + 200562D21E5D07750015AD55 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = 5ZZ7W4SB26; + INFOPLIST_FILE = SimcoeExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimcoeExample.app/SimcoeExample"; + }; + name = Debug; + }; + 200562D31E5D07750015AD55 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = 5ZZ7W4SB26; + INFOPLIST_FILE = SimcoeExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimcoeExample.app/SimcoeExample"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 200562AC1E5D07750015AD55 /* Build configuration list for PBXProject "SimcoeExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 200562CC1E5D07750015AD55 /* Debug */, + 200562CD1E5D07750015AD55 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 200562CE1E5D07750015AD55 /* Build configuration list for PBXNativeTarget "SimcoeExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 200562CF1E5D07750015AD55 /* Debug */, + 200562D01E5D07750015AD55 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 200562D11E5D07750015AD55 /* Build configuration list for PBXNativeTarget "SimcoeExampleTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 200562D21E5D07750015AD55 /* Debug */, + 200562D31E5D07750015AD55 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 200562A91E5D07750015AD55 /* Project object */; +} diff --git a/SimcoeExample3/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift b/SimcoeExample3/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift new file mode 100644 index 0000000..1062f22 --- /dev/null +++ b/SimcoeExample3/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift @@ -0,0 +1,138 @@ +// +// AnalyticsDisplayViewController.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import UIKit +import Simcoe +import CoreLocation +import mParticle_Apple_SDK + +internal class AnalyticsTracker { + + var providers: [AnalyticsTracking] + + var actions: [TrackerAction] + + var name: String + + init(providers: [AnalyticsTracking], actions: [TrackerAction], name: String) { + self.providers = providers + self.actions = actions + self.name = name + } +} + +internal protocol TrackerAction { + + var name: String { get } + + func track() +} + +internal class EventTrackerAction: TrackerAction { + + var name: String { + return "Track Event" + } + + func track() { + var eventDataProperties: Properties = MPEvent.eventData(type: .other, name: "") + eventDataProperties["Location"] = "Tracker Page" + + Simcoe.track(event: "Tapped Track Event", withAdditionalProperties: eventDataProperties) + } +} + +internal class LifetimeValueIncreasingAction: TrackerAction { + + var name: String { + return "Track Lifetime Value Increase" + } + + func track() { + let properties: Properties = ["Location" : "Tracker Page"] + Simcoe.trackLifetimeIncrease(byAmount: 1, + forItem: "Track Lifetime Value Tapped", + withAdditionalProperties: properties) + } +} + +internal class LocationTrackingAction: TrackerAction { + + var name: String { + return "Track Location" + } + + func track() { + let properties: Properties = ["Location" : "Tracker Page"] + let location = CLLocation(latitude: 40.7128, longitude: 74.0059) + Simcoe.track(location: location, withAdditionalProperties: properties) + } +} + +internal class PageViewTrackingAction: TrackerAction { + + var name: String { + return "Track Page View" + } + + func track() { + let properties: Properties = ["Location" : "Tracker Page"] + Simcoe.track(pageView: "Tracker Selection Page View", withAdditionalProperties: properties) + } +} + +internal final class AnalyticsDisplayViewController: UITableViewController { + + var providers: [AnalyticsTracker] = [] + + override func viewDidLoad() { + super.viewDidLoad() + + let particle = mParticle(key: "ef79020ccbbfcf198717de75f0a406b4", secret: "0195e9e766b5b87aa2095d926f1d527e") + let adobe = Adobe() + + setupTrackers(providers: [adobe], name: adobe.name) + setupTrackers(providers: [particle], name: particle.name) + setupTrackers(providers: [adobe, particle], name: "All Analytics Trackers") + setupTrackers(providers: [], name: "None") + } + + private func setupTrackers(providers: [AnalyticsTracking], name: String) { + let actions: [TrackerAction] = [EventTrackerAction(), + LocationTrackingAction(), + LifetimeValueIncreasingAction(), + PageViewTrackingAction()] + + self.providers.append(AnalyticsTracker(providers: providers, actions: actions, name: name)) + } +} + +extension AnalyticsDisplayViewController { + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return providers.count + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = UITableViewCell() + cell.textLabel?.text = providers[indexPath.row].name + cell.accessoryType = .disclosureIndicator + return cell + } + + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + + let trackerVC = TrackerTableViewController.storyboardInit() + + Simcoe.run(with: providers[indexPath.row].providers) + + trackerVC.trackers = providers[indexPath.row].actions + navigationController?.pushViewController(trackerVC, animated: true) + } +} diff --git a/SimcoeExample3/SimcoeExample/SimcoeExample/AppDelegate.swift b/SimcoeExample3/SimcoeExample/SimcoeExample/AppDelegate.swift new file mode 100644 index 0000000..48653b7 --- /dev/null +++ b/SimcoeExample3/SimcoeExample/SimcoeExample/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/SimcoeExample3/SimcoeExample/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/SimcoeExample3/SimcoeExample/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..118c98f --- /dev/null +++ b/SimcoeExample3/SimcoeExample/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SimcoeExample3/SimcoeExample/SimcoeExample/Base.lproj/LaunchScreen.storyboard b/SimcoeExample3/SimcoeExample/SimcoeExample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..fdf3f97 --- /dev/null +++ b/SimcoeExample3/SimcoeExample/SimcoeExample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimcoeExample3/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard b/SimcoeExample3/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard new file mode 100644 index 0000000..4f9e1f7 --- /dev/null +++ b/SimcoeExample3/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimcoeExample3/SimcoeExample/SimcoeExample/Info.plist b/SimcoeExample3/SimcoeExample/SimcoeExample/Info.plist new file mode 100644 index 0000000..38e98af --- /dev/null +++ b/SimcoeExample3/SimcoeExample/SimcoeExample/Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/SimcoeExample3/SimcoeExample/SimcoeExample/Tracker.storyboard b/SimcoeExample3/SimcoeExample/SimcoeExample/Tracker.storyboard new file mode 100644 index 0000000..1828a24 --- /dev/null +++ b/SimcoeExample3/SimcoeExample/SimcoeExample/Tracker.storyboard @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimcoeExample3/SimcoeExample/SimcoeExample/TrackerTableViewController.swift b/SimcoeExample3/SimcoeExample/SimcoeExample/TrackerTableViewController.swift new file mode 100644 index 0000000..ba16a0f --- /dev/null +++ b/SimcoeExample3/SimcoeExample/SimcoeExample/TrackerTableViewController.swift @@ -0,0 +1,38 @@ +// +// TrackerTableViewController.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import UIKit +import Simcoe + +internal final class TrackerTableViewController: UITableViewController { + + var trackers: [TrackerAction]! + + static func storyboardInit() -> TrackerTableViewController { + let storyBoard = UIStoryboard(name: "Tracker", bundle: nil) + return storyBoard.instantiateViewController(withIdentifier: "TrackerTableViewController") as! TrackerTableViewController + } +} + +extension TrackerTableViewController { + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return trackers.count + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = UITableViewCell() + cell.textLabel?.text = trackers[indexPath.row].name + return cell + } + + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + trackers[indexPath.row].track() + } +} diff --git a/SimcoeExample3/SimcoeExample/SimcoeExampleTests/Info.plist b/SimcoeExample3/SimcoeExample/SimcoeExampleTests/Info.plist new file mode 100644 index 0000000..6c6c23c --- /dev/null +++ b/SimcoeExample3/SimcoeExample/SimcoeExampleTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/SimcoeExample3/SimcoeExample/SimcoeExampleTests/SimcoeExampleTests.swift b/SimcoeExample3/SimcoeExample/SimcoeExampleTests/SimcoeExampleTests.swift new file mode 100644 index 0000000..6bfc97f --- /dev/null +++ b/SimcoeExample3/SimcoeExample/SimcoeExampleTests/SimcoeExampleTests.swift @@ -0,0 +1,36 @@ +// +// SimcoeExampleTests.swift +// SimcoeExampleTests +// +// Created by Jonathan Samudio on 2/21/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import XCTest +@testable import SimcoeExample + +class SimcoeExampleTests: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/mParticleExample/mParticleExample.xcodeproj/project.pbxproj b/mParticleExample/mParticleExample.xcodeproj/project.pbxproj deleted file mode 100644 index b68e688..0000000 --- a/mParticleExample/mParticleExample.xcodeproj/project.pbxproj +++ /dev/null @@ -1,383 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 0C0460CC4E74C7C1DAF81892 /* Pods_mParticleExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 075A0BE6B064899013AA2BA0 /* Pods_mParticleExample.framework */; }; - 270708AE1DBFF5E200A7F4BA /* ExampleProduct.swift in Sources */ = {isa = PBXBuildFile; fileRef = 270708AD1DBFF5E200A7F4BA /* ExampleProduct.swift */; }; - 723FD4CF1C77FEB70069622D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 723FD4CE1C77FEB70069622D /* AppDelegate.swift */; }; - 723FD4D11C77FEB70069622D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 723FD4D01C77FEB70069622D /* ViewController.swift */; }; - 723FD4D41C77FEB70069622D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 723FD4D21C77FEB70069622D /* Main.storyboard */; }; - 723FD4D61C77FEB70069622D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 723FD4D51C77FEB70069622D /* Assets.xcassets */; }; - 723FD4D91C77FEB70069622D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 723FD4D71C77FEB70069622D /* LaunchScreen.storyboard */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 075A0BE6B064899013AA2BA0 /* Pods_mParticleExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_mParticleExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 270708AD1DBFF5E200A7F4BA /* ExampleProduct.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleProduct.swift; sourceTree = ""; }; - 723FD4CB1C77FEB70069622D /* mParticleExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = mParticleExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 723FD4CE1C77FEB70069622D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 723FD4D01C77FEB70069622D /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - 723FD4D31C77FEB70069622D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 723FD4D51C77FEB70069622D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 723FD4D81C77FEB70069622D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 723FD4DA1C77FEB70069622D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 7953BD23412008F4D96AB8C6 /* Pods-mParticleExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-mParticleExample.release.xcconfig"; path = "../Pods/Target Support Files/Pods-mParticleExample/Pods-mParticleExample.release.xcconfig"; sourceTree = ""; }; - C1516C30BC7AB9E7D447DE08 /* Pods-mParticleExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-mParticleExample.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-mParticleExample/Pods-mParticleExample.debug.xcconfig"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 723FD4C81C77FEB70069622D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 0C0460CC4E74C7C1DAF81892 /* Pods_mParticleExample.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 723FD4C21C77FEB70069622D = { - isa = PBXGroup; - children = ( - 723FD4CD1C77FEB70069622D /* mParticleExample */, - 723FD4CC1C77FEB70069622D /* Products */, - 9D25F56F56EFF94CD6F44EB2 /* Pods */, - A4909BDFF000BCFF71573AEC /* Frameworks */, - ); - sourceTree = ""; - }; - 723FD4CC1C77FEB70069622D /* Products */ = { - isa = PBXGroup; - children = ( - 723FD4CB1C77FEB70069622D /* mParticleExample.app */, - ); - name = Products; - sourceTree = ""; - }; - 723FD4CD1C77FEB70069622D /* mParticleExample */ = { - isa = PBXGroup; - children = ( - 723FD4CE1C77FEB70069622D /* AppDelegate.swift */, - 723FD4D01C77FEB70069622D /* ViewController.swift */, - 723FD4D21C77FEB70069622D /* Main.storyboard */, - 723FD4D51C77FEB70069622D /* Assets.xcassets */, - 723FD4D71C77FEB70069622D /* LaunchScreen.storyboard */, - 723FD4DA1C77FEB70069622D /* Info.plist */, - 270708AD1DBFF5E200A7F4BA /* ExampleProduct.swift */, - ); - path = mParticleExample; - sourceTree = ""; - }; - 9D25F56F56EFF94CD6F44EB2 /* Pods */ = { - isa = PBXGroup; - children = ( - C1516C30BC7AB9E7D447DE08 /* Pods-mParticleExample.debug.xcconfig */, - 7953BD23412008F4D96AB8C6 /* Pods-mParticleExample.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; - A4909BDFF000BCFF71573AEC /* Frameworks */ = { - isa = PBXGroup; - children = ( - 075A0BE6B064899013AA2BA0 /* Pods_mParticleExample.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 723FD4CA1C77FEB70069622D /* mParticleExample */ = { - isa = PBXNativeTarget; - buildConfigurationList = 723FD4DD1C77FEB70069622D /* Build configuration list for PBXNativeTarget "mParticleExample" */; - buildPhases = ( - 820C1B8E4D0C443BE9D548B8 /* [CP] Check Pods Manifest.lock */, - 723FD4C71C77FEB70069622D /* Sources */, - 723FD4C81C77FEB70069622D /* Frameworks */, - 723FD4C91C77FEB70069622D /* Resources */, - C903A518F64670F7E00F34D0 /* [CP] Embed Pods Frameworks */, - 19D1A593ECFE3C73C235148A /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = mParticleExample; - productName = mParticleExample; - productReference = 723FD4CB1C77FEB70069622D /* mParticleExample.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 723FD4C31C77FEB70069622D /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0800; - ORGANIZATIONNAME = "Prolific Interactive"; - TargetAttributes = { - 723FD4CA1C77FEB70069622D = { - CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0800; - }; - }; - }; - buildConfigurationList = 723FD4C61C77FEB70069622D /* Build configuration list for PBXProject "mParticleExample" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 723FD4C21C77FEB70069622D; - productRefGroup = 723FD4CC1C77FEB70069622D /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 723FD4CA1C77FEB70069622D /* mParticleExample */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 723FD4C91C77FEB70069622D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 723FD4D91C77FEB70069622D /* LaunchScreen.storyboard in Resources */, - 723FD4D61C77FEB70069622D /* Assets.xcassets in Resources */, - 723FD4D41C77FEB70069622D /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 19D1A593ECFE3C73C235148A /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-mParticleExample/Pods-mParticleExample-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 820C1B8E4D0C443BE9D548B8 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../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"; - showEnvVarsInLog = 0; - }; - C903A518F64670F7E00F34D0 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-mParticleExample/Pods-mParticleExample-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 723FD4C71C77FEB70069622D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 723FD4D11C77FEB70069622D /* ViewController.swift in Sources */, - 723FD4CF1C77FEB70069622D /* AppDelegate.swift in Sources */, - 270708AE1DBFF5E200A7F4BA /* ExampleProduct.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 723FD4D21C77FEB70069622D /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 723FD4D31C77FEB70069622D /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 723FD4D71C77FEB70069622D /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 723FD4D81C77FEB70069622D /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 723FD4DB1C77FEB70069622D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.2; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - 723FD4DC1C77FEB70069622D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.2; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 723FD4DE1C77FEB70069622D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C1516C30BC7AB9E7D447DE08 /* Pods-mParticleExample.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = mParticleExample/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.mParticleExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - 723FD4DF1C77FEB70069622D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7953BD23412008F4D96AB8C6 /* Pods-mParticleExample.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = mParticleExample/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.mParticleExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 723FD4C61C77FEB70069622D /* Build configuration list for PBXProject "mParticleExample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 723FD4DB1C77FEB70069622D /* Debug */, - 723FD4DC1C77FEB70069622D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 723FD4DD1C77FEB70069622D /* Build configuration list for PBXNativeTarget "mParticleExample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 723FD4DE1C77FEB70069622D /* Debug */, - 723FD4DF1C77FEB70069622D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 723FD4C31C77FEB70069622D /* Project object */; -} diff --git a/mParticleExample/mParticleExample.xcodeproj/xcshareddata/xcschemes/mParticleExample.xcscheme b/mParticleExample/mParticleExample.xcodeproj/xcshareddata/xcschemes/mParticleExample.xcscheme deleted file mode 100644 index 1070fd9..0000000 --- a/mParticleExample/mParticleExample.xcodeproj/xcshareddata/xcschemes/mParticleExample.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 29b5c399d5d0e75185c626dd74e8da120adc3c85 Mon Sep 17 00:00:00 2001 From: Jonathan Samudio Date: Wed, 22 Feb 2017 10:52:52 -0500 Subject: [PATCH 05/11] Updated the simcoe example project with new class file structure. --- .../Analytics Engine/SimcoeAnalyticsEngine.swift | 9 +++++++++ .../SimcoeExample/Helper Classes/AnalyticsTracker.swift | 9 +++++++++ .../SimcoeExample/Protocols/AnalyticsEngine.swift | 9 +++++++++ .../SimcoeExample/Protocols/TrackerAction.swift | 9 +++++++++ .../TrackerActions/EventTrackerAction.swift | 9 +++++++++ .../TrackerActions/LifetimeValueIncreasingAction.swift | 9 +++++++++ .../TrackerActions/LocationTrackingAction.swift | 9 +++++++++ .../TrackerActions/PageViewTrackingAction.swift | 9 +++++++++ 8 files changed, 72 insertions(+) create mode 100644 SimcoeExample/SimcoeExample/Analytics Engine/SimcoeAnalyticsEngine.swift create mode 100644 SimcoeExample/SimcoeExample/Helper Classes/AnalyticsTracker.swift create mode 100644 SimcoeExample/SimcoeExample/Protocols/AnalyticsEngine.swift create mode 100644 SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift create mode 100644 SimcoeExample/SimcoeExample/TrackerActions/EventTrackerAction.swift create mode 100644 SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift create mode 100644 SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift create mode 100644 SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift diff --git a/SimcoeExample/SimcoeExample/Analytics Engine/SimcoeAnalyticsEngine.swift b/SimcoeExample/SimcoeExample/Analytics Engine/SimcoeAnalyticsEngine.swift new file mode 100644 index 0000000..82cd9b6 --- /dev/null +++ b/SimcoeExample/SimcoeExample/Analytics Engine/SimcoeAnalyticsEngine.swift @@ -0,0 +1,9 @@ +// +// SimcoeAnalyticsEngine.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/22/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation diff --git a/SimcoeExample/SimcoeExample/Helper Classes/AnalyticsTracker.swift b/SimcoeExample/SimcoeExample/Helper Classes/AnalyticsTracker.swift new file mode 100644 index 0000000..9d6c37b --- /dev/null +++ b/SimcoeExample/SimcoeExample/Helper Classes/AnalyticsTracker.swift @@ -0,0 +1,9 @@ +// +// AnalyticsTracker.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/22/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation diff --git a/SimcoeExample/SimcoeExample/Protocols/AnalyticsEngine.swift b/SimcoeExample/SimcoeExample/Protocols/AnalyticsEngine.swift new file mode 100644 index 0000000..3f775d4 --- /dev/null +++ b/SimcoeExample/SimcoeExample/Protocols/AnalyticsEngine.swift @@ -0,0 +1,9 @@ +// +// AnalyticsEngine.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/22/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation diff --git a/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift b/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift new file mode 100644 index 0000000..9626fde --- /dev/null +++ b/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift @@ -0,0 +1,9 @@ +// +// TrackerAction.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/22/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation diff --git a/SimcoeExample/SimcoeExample/TrackerActions/EventTrackerAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/EventTrackerAction.swift new file mode 100644 index 0000000..1230b55 --- /dev/null +++ b/SimcoeExample/SimcoeExample/TrackerActions/EventTrackerAction.swift @@ -0,0 +1,9 @@ +// +// EventTrackerAction.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/22/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation diff --git a/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift new file mode 100644 index 0000000..8b5747c --- /dev/null +++ b/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift @@ -0,0 +1,9 @@ +// +// LifetimeValueIncreasingAction.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/22/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation diff --git a/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift new file mode 100644 index 0000000..72a726b --- /dev/null +++ b/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift @@ -0,0 +1,9 @@ +// +// LocationTrackingAction.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/22/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation diff --git a/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift new file mode 100644 index 0000000..290cf6e --- /dev/null +++ b/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift @@ -0,0 +1,9 @@ +// +// PageViewTrackingAction.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/22/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation From d2bf766963f4e4689f5abfcd637188a27b83e6be Mon Sep 17 00:00:00 2001 From: Jonathan Samudio Date: Wed, 22 Feb 2017 10:59:58 -0500 Subject: [PATCH 06/11] Added tracker action generator. --- .../SimcoeExample.xcodeproj/project.pbxproj | 64 +++++++++++++ .../SimcoeAnalyticsEngine.swift | 28 ++++++ .../AnalyticsDisplayViewController.swift | 92 ++++--------------- .../Helper Classes/AnalyticsTracker.swift | 16 ++++ .../Protocols/AnalyticsEngine.swift | 17 ++++ .../Protocols/TrackerAction.swift | 7 ++ .../TrackerActions/EventTrackerAction.swift | 22 +++++ .../LifetimeValueIncreasingAction.swift | 21 +++++ .../LocationTrackingAction.swift | 21 +++++ .../PageViewTrackingAction.swift | 20 ++++ 10 files changed, 233 insertions(+), 75 deletions(-) diff --git a/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj b/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj index 43f804e..d142e42 100644 --- a/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj +++ b/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj @@ -7,6 +7,14 @@ objects = { /* Begin PBXBuildFile section */ + 200562E11E5DE5A60015AD55 /* TrackerAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562E01E5DE5A60015AD55 /* TrackerAction.swift */; }; + 200562E31E5DE5BA0015AD55 /* EventTrackerAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562E21E5DE5BA0015AD55 /* EventTrackerAction.swift */; }; + 200562E51E5DE5CC0015AD55 /* LifetimeValueIncreasingAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562E41E5DE5CC0015AD55 /* LifetimeValueIncreasingAction.swift */; }; + 200562E71E5DE5DD0015AD55 /* LocationTrackingAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562E61E5DE5DD0015AD55 /* LocationTrackingAction.swift */; }; + 200562E91E5DE5EB0015AD55 /* PageViewTrackingAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562E81E5DE5EB0015AD55 /* PageViewTrackingAction.swift */; }; + 200562EC1E5DEA530015AD55 /* SimcoeAnalyticsEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562EB1E5DEA530015AD55 /* SimcoeAnalyticsEngine.swift */; }; + 200562EE1E5DEA780015AD55 /* AnalyticsEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562ED1E5DEA780015AD55 /* AnalyticsEngine.swift */; }; + 200562F11E5DEAB20015AD55 /* AnalyticsTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562F01E5DEAB20015AD55 /* AnalyticsTracker.swift */; }; 20C3B1B11E5CE6F70095F185 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */; }; 20C3B1B61E5CE6F70095F185 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B41E5CE6F70095F185 /* Main.storyboard */; }; 20C3B1B81E5CE6F70095F185 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */; }; @@ -29,6 +37,14 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 200562E01E5DE5A60015AD55 /* TrackerAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrackerAction.swift; sourceTree = ""; }; + 200562E21E5DE5BA0015AD55 /* EventTrackerAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventTrackerAction.swift; sourceTree = ""; }; + 200562E41E5DE5CC0015AD55 /* LifetimeValueIncreasingAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LifetimeValueIncreasingAction.swift; sourceTree = ""; }; + 200562E61E5DE5DD0015AD55 /* LocationTrackingAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocationTrackingAction.swift; sourceTree = ""; }; + 200562E81E5DE5EB0015AD55 /* PageViewTrackingAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageViewTrackingAction.swift; sourceTree = ""; }; + 200562EB1E5DEA530015AD55 /* SimcoeAnalyticsEngine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimcoeAnalyticsEngine.swift; sourceTree = ""; }; + 200562ED1E5DEA780015AD55 /* AnalyticsEngine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnalyticsEngine.swift; sourceTree = ""; }; + 200562F01E5DEAB20015AD55 /* AnalyticsTracker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnalyticsTracker.swift; sourceTree = ""; }; 20C3B1AD1E5CE6F70095F185 /* SimcoeExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimcoeExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 20C3B1B51E5CE6F70095F185 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -65,6 +81,42 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 200562DE1E5DE59A0015AD55 /* TrackerActions */ = { + isa = PBXGroup; + children = ( + 200562E21E5DE5BA0015AD55 /* EventTrackerAction.swift */, + 200562E41E5DE5CC0015AD55 /* LifetimeValueIncreasingAction.swift */, + 200562E61E5DE5DD0015AD55 /* LocationTrackingAction.swift */, + 200562E81E5DE5EB0015AD55 /* PageViewTrackingAction.swift */, + ); + path = TrackerActions; + sourceTree = ""; + }; + 200562DF1E5DE59A0015AD55 /* Protocols */ = { + isa = PBXGroup; + children = ( + 200562E01E5DE5A60015AD55 /* TrackerAction.swift */, + 200562ED1E5DEA780015AD55 /* AnalyticsEngine.swift */, + ); + path = Protocols; + sourceTree = ""; + }; + 200562EA1E5DEA4D0015AD55 /* Analytics Engine */ = { + isa = PBXGroup; + children = ( + 200562EB1E5DEA530015AD55 /* SimcoeAnalyticsEngine.swift */, + ); + path = "Analytics Engine"; + sourceTree = ""; + }; + 200562EF1E5DEAAB0015AD55 /* Helper Classes */ = { + isa = PBXGroup; + children = ( + 200562F01E5DEAB20015AD55 /* AnalyticsTracker.swift */, + ); + path = "Helper Classes"; + sourceTree = ""; + }; 20C3B1A41E5CE6F70095F185 = { isa = PBXGroup; children = ( @@ -96,6 +148,10 @@ 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */, 20C3B1B91E5CE6F70095F185 /* LaunchScreen.storyboard */, 20C3B1BC1E5CE6F70095F185 /* Info.plist */, + 200562EA1E5DEA4D0015AD55 /* Analytics Engine */, + 200562DE1E5DE59A0015AD55 /* TrackerActions */, + 200562DF1E5DE59A0015AD55 /* Protocols */, + 200562EF1E5DEAAB0015AD55 /* Helper Classes */, ); path = SimcoeExample; sourceTree = ""; @@ -283,8 +339,16 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 200562E91E5DE5EB0015AD55 /* PageViewTrackingAction.swift in Sources */, + 200562E11E5DE5A60015AD55 /* TrackerAction.swift in Sources */, + 200562E51E5DE5CC0015AD55 /* LifetimeValueIncreasingAction.swift in Sources */, 20C3B1D31E5CED6C0095F185 /* TrackerTableViewController.swift in Sources */, + 200562EE1E5DEA780015AD55 /* AnalyticsEngine.swift in Sources */, + 200562EC1E5DEA530015AD55 /* SimcoeAnalyticsEngine.swift in Sources */, + 200562E31E5DE5BA0015AD55 /* EventTrackerAction.swift in Sources */, + 200562E71E5DE5DD0015AD55 /* LocationTrackingAction.swift in Sources */, 20C3B1D11E5CE7D70095F185 /* AnalyticsDisplayViewController.swift in Sources */, + 200562F11E5DEAB20015AD55 /* AnalyticsTracker.swift in Sources */, 20C3B1B11E5CE6F70095F185 /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/SimcoeExample/SimcoeExample/Analytics Engine/SimcoeAnalyticsEngine.swift b/SimcoeExample/SimcoeExample/Analytics Engine/SimcoeAnalyticsEngine.swift index 82cd9b6..eedfb7a 100644 --- a/SimcoeExample/SimcoeExample/Analytics Engine/SimcoeAnalyticsEngine.swift +++ b/SimcoeExample/SimcoeExample/Analytics Engine/SimcoeAnalyticsEngine.swift @@ -7,3 +7,31 @@ // import Foundation +import Simcoe +import CoreLocation + +internal class SimcoeAnalyticsEngine: AnalyticsEngine { + + func run(with providers: [AnalyticsTracking]) { + Simcoe.run(with: providers) + } + + func track(event: String, withAdditionalProperties properties: Properties?) { + Simcoe.track(event: event, withAdditionalProperties: properties) + } + + func trackLifetimeIncrease(byAmount amount: Double, + forItem item: String?, + withAdditionalProperties properties: Properties?) { + + Simcoe.trackLifetimeIncrease(byAmount: amount, forItem: item, withAdditionalProperties: properties) + } + + func track(location: CLLocation, withAdditionalProperties properties: Properties?) { + Simcoe.track(location: location, withAdditionalProperties: properties) + } + + func track(pageView: String, withAdditionalProperties properties: Properties?) { + Simcoe.track(pageView: pageView, withAdditionalProperties: properties) + } +} diff --git a/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift b/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift index 1062f22..dad65ab 100644 --- a/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift +++ b/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift @@ -11,78 +11,16 @@ import Simcoe import CoreLocation import mParticle_Apple_SDK -internal class AnalyticsTracker { +internal final class TrackerActionGenerator { - var providers: [AnalyticsTracking] - - var actions: [TrackerAction] - - var name: String - - init(providers: [AnalyticsTracking], actions: [TrackerAction], name: String) { - self.providers = providers - self.actions = actions - self.name = name - } -} - -internal protocol TrackerAction { - - var name: String { get } - - func track() -} - -internal class EventTrackerAction: TrackerAction { - - var name: String { - return "Track Event" - } - - func track() { - var eventDataProperties: Properties = MPEvent.eventData(type: .other, name: "") - eventDataProperties["Location"] = "Tracker Page" + func trackerActions(providers: [AnalyticsTracking]) -> [TrackerAction] { + var actions: [TrackerAction] = [] - Simcoe.track(event: "Tapped Track Event", withAdditionalProperties: eventDataProperties) - } -} - -internal class LifetimeValueIncreasingAction: TrackerAction { - - var name: String { - return "Track Lifetime Value Increase" - } - - func track() { - let properties: Properties = ["Location" : "Tracker Page"] - Simcoe.trackLifetimeIncrease(byAmount: 1, - forItem: "Track Lifetime Value Tapped", - withAdditionalProperties: properties) - } -} - -internal class LocationTrackingAction: TrackerAction { - - var name: String { - return "Track Location" - } - - func track() { - let properties: Properties = ["Location" : "Tracker Page"] - let location = CLLocation(latitude: 40.7128, longitude: 74.0059) - Simcoe.track(location: location, withAdditionalProperties: properties) - } -} - -internal class PageViewTrackingAction: TrackerAction { - - var name: String { - return "Track Page View" - } - - func track() { - let properties: Properties = ["Location" : "Tracker Page"] - Simcoe.track(pageView: "Tracker Selection Page View", withAdditionalProperties: properties) + for provider in providers { + + } + + return actions } } @@ -90,6 +28,10 @@ internal final class AnalyticsDisplayViewController: UITableViewController { var providers: [AnalyticsTracker] = [] + lazy var analyticsEngine: AnalyticsEngine = { + return SimcoeAnalyticsEngine() + }() + override func viewDidLoad() { super.viewDidLoad() @@ -103,10 +45,10 @@ internal final class AnalyticsDisplayViewController: UITableViewController { } private func setupTrackers(providers: [AnalyticsTracking], name: String) { - let actions: [TrackerAction] = [EventTrackerAction(), - LocationTrackingAction(), - LifetimeValueIncreasingAction(), - PageViewTrackingAction()] + let actions: [TrackerAction] = [EventTrackerAction(engine: analyticsEngine), + LocationTrackingAction(engine: analyticsEngine), + LifetimeValueIncreasingAction(engine: analyticsEngine), + PageViewTrackingAction(engine: analyticsEngine)] self.providers.append(AnalyticsTracker(providers: providers, actions: actions, name: name)) } @@ -130,7 +72,7 @@ extension AnalyticsDisplayViewController { let trackerVC = TrackerTableViewController.storyboardInit() - Simcoe.run(with: providers[indexPath.row].providers) + analyticsEngine.run(with: providers[indexPath.row].providers) trackerVC.trackers = providers[indexPath.row].actions navigationController?.pushViewController(trackerVC, animated: true) diff --git a/SimcoeExample/SimcoeExample/Helper Classes/AnalyticsTracker.swift b/SimcoeExample/SimcoeExample/Helper Classes/AnalyticsTracker.swift index 9d6c37b..a47072f 100644 --- a/SimcoeExample/SimcoeExample/Helper Classes/AnalyticsTracker.swift +++ b/SimcoeExample/SimcoeExample/Helper Classes/AnalyticsTracker.swift @@ -7,3 +7,19 @@ // import Foundation +import Simcoe + +internal class AnalyticsTracker { + + var providers: [AnalyticsTracking] + + var actions: [TrackerAction] + + var name: String + + init(providers: [AnalyticsTracking], actions: [TrackerAction], name: String) { + self.providers = providers + self.actions = actions + self.name = name + } +} diff --git a/SimcoeExample/SimcoeExample/Protocols/AnalyticsEngine.swift b/SimcoeExample/SimcoeExample/Protocols/AnalyticsEngine.swift index 3f775d4..f3cbdf0 100644 --- a/SimcoeExample/SimcoeExample/Protocols/AnalyticsEngine.swift +++ b/SimcoeExample/SimcoeExample/Protocols/AnalyticsEngine.swift @@ -7,3 +7,20 @@ // import Foundation +import Simcoe +import CoreLocation + +internal protocol AnalyticsEngine { + + func run(with providers: [AnalyticsTracking]) + + func track(event: String, withAdditionalProperties properties: Properties?) + + func trackLifetimeIncrease(byAmount amount: Double, + forItem item: String?, + withAdditionalProperties properties: Properties?) + + func track(location: CLLocation, withAdditionalProperties properties: Properties?) + + func track(pageView: String, withAdditionalProperties properties: Properties?) +} diff --git a/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift b/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift index 9626fde..f824b6a 100644 --- a/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift +++ b/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift @@ -7,3 +7,10 @@ // import Foundation + +internal protocol TrackerAction { + + var name: String { get } + + func track() +} diff --git a/SimcoeExample/SimcoeExample/TrackerActions/EventTrackerAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/EventTrackerAction.swift index 1230b55..8145de0 100644 --- a/SimcoeExample/SimcoeExample/TrackerActions/EventTrackerAction.swift +++ b/SimcoeExample/SimcoeExample/TrackerActions/EventTrackerAction.swift @@ -7,3 +7,25 @@ // import Foundation +import Simcoe +import mParticle_Apple_SDK + +internal class EventTrackerAction: TrackerAction { + + var name: String { + return "Track Event" + } + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine) { + self.engine = engine + } + + func track() { + var eventDataProperties: Properties = MPEvent.eventData(type: .other, name: "") + eventDataProperties["Location"] = "Tracker Page" + + engine.track(event: "Tapped Track Event", withAdditionalProperties: eventDataProperties) + } +} diff --git a/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift index 8b5747c..c06bbb9 100644 --- a/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift +++ b/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift @@ -7,3 +7,24 @@ // import Foundation +import Simcoe + +internal class LifetimeValueIncreasingAction: TrackerAction { + + var name: String { + return "Track Lifetime Value Increase" + } + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine) { + self.engine = engine + } + + func track() { + let properties: Properties = ["Location" : "Tracker Page"] + engine.trackLifetimeIncrease(byAmount: 1, + forItem: "Track Lifetime Value Tapped", + withAdditionalProperties: properties) + } +} diff --git a/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift index 72a726b..8e8376d 100644 --- a/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift +++ b/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift @@ -7,3 +7,24 @@ // import Foundation +import Simcoe +import CoreLocation + +internal class LocationTrackingAction: TrackerAction { + + var name: String { + return "Track Location" + } + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine) { + self.engine = engine + } + + func track() { + let properties: Properties = ["Location" : "Tracker Page"] + let location = CLLocation(latitude: 40.7128, longitude: 74.0059) + engine.track(location: location, withAdditionalProperties: properties) + } +} diff --git a/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift index 290cf6e..0e2f3cd 100644 --- a/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift +++ b/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift @@ -7,3 +7,23 @@ // import Foundation +import Simcoe +import CoreLocation + +internal class PageViewTrackingAction: TrackerAction { + + var name: String { + return "Track Page View" + } + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine) { + self.engine = engine + } + + func track() { + let properties: Properties = ["Location" : "Tracker Page"] + engine.track(pageView: "Tracker Selection Page View", withAdditionalProperties: properties) + } +} From ee96e98c77498e1acc3fe2601ced9771ae3be38b Mon Sep 17 00:00:00 2001 From: Jonathan Samudio Date: Wed, 22 Feb 2017 14:02:28 -0500 Subject: [PATCH 07/11] Added logic for the tracker action generator. --- .../AnalyticsDisplayViewController.swift | 45 ++++++++++++++++--- .../Protocols/TrackerAction.swift | 14 ++++++ .../TrackerActions/EventTrackerAction.swift | 4 ++ .../LifetimeValueIncreasingAction.swift | 4 ++ .../LocationTrackingAction.swift | 4 ++ .../PageViewTrackingAction.swift | 4 ++ 6 files changed, 68 insertions(+), 7 deletions(-) diff --git a/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift b/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift index dad65ab..7efc143 100644 --- a/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift +++ b/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift @@ -11,13 +11,34 @@ import Simcoe import CoreLocation import mParticle_Apple_SDK -internal final class TrackerActionGenerator { +internal protocol ActionGenerator { + + func trackerActions(providers: [AnalyticsTracking]) -> [TrackerAction] + +} + +internal final class TrackerActionGenerator: ActionGenerator { + + private var engine: AnalyticsEngine + + private var availableTrackerActions: [TrackerAction] + + init(engine: AnalyticsEngine, availableTrackerActions: [TrackerAction]) { + self.engine = engine + self.availableTrackerActions = availableTrackerActions + } func trackerActions(providers: [AnalyticsTracking]) -> [TrackerAction] { var actions: [TrackerAction] = [] for provider in providers { - + for action in availableTrackerActions { + if action.isActionAvailable(provider: provider) == true && + action.isContainedIn(actions: actions) == false { + + actions.append(action) + } + } } return actions @@ -35,7 +56,7 @@ internal final class AnalyticsDisplayViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() - let particle = mParticle(key: "ef79020ccbbfcf198717de75f0a406b4", secret: "0195e9e766b5b87aa2095d926f1d527e") + let particle = mParticle(key: "mikesaidtomakeafakeone", secret: "hiyoseob") let adobe = Adobe() setupTrackers(providers: [adobe], name: adobe.name) @@ -45,10 +66,20 @@ internal final class AnalyticsDisplayViewController: UITableViewController { } private func setupTrackers(providers: [AnalyticsTracking], name: String) { - let actions: [TrackerAction] = [EventTrackerAction(engine: analyticsEngine), - LocationTrackingAction(engine: analyticsEngine), - LifetimeValueIncreasingAction(engine: analyticsEngine), - PageViewTrackingAction(engine: analyticsEngine)] + + let availableActions: [TrackerAction] = [EventTrackerAction(engine: analyticsEngine), + LocationTrackingAction(engine: analyticsEngine), + LifetimeValueIncreasingAction(engine: analyticsEngine), + PageViewTrackingAction(engine: analyticsEngine)] + + guard !providers.isEmpty else { + self.providers.append(AnalyticsTracker(providers: providers, actions: availableActions, name: name)) + return + } + + + let actionGenerator = TrackerActionGenerator(engine: analyticsEngine, availableTrackerActions: availableActions) + let actions = actionGenerator.trackerActions(providers: providers) self.providers.append(AnalyticsTracker(providers: providers, actions: actions, name: name)) } diff --git a/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift b/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift index f824b6a..c804601 100644 --- a/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift +++ b/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift @@ -7,10 +7,24 @@ // import Foundation +import Simcoe internal protocol TrackerAction { var name: String { get } + func isActionAvailable(provider: AnalyticsTracking) -> Bool + func track() + + func isContainedIn(actions: [TrackerAction]) -> Bool +} + +extension TrackerAction { + + func isContainedIn(actions: [TrackerAction]) -> Bool { + return actions.contains(where: { (arrayAction) -> Bool in + return name == arrayAction.name + }) + } } diff --git a/SimcoeExample/SimcoeExample/TrackerActions/EventTrackerAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/EventTrackerAction.swift index 8145de0..21284e8 100644 --- a/SimcoeExample/SimcoeExample/TrackerActions/EventTrackerAction.swift +++ b/SimcoeExample/SimcoeExample/TrackerActions/EventTrackerAction.swift @@ -22,6 +22,10 @@ internal class EventTrackerAction: TrackerAction { self.engine = engine } + func isActionAvailable(provider: AnalyticsTracking) -> Bool { + return provider is EventTracking + } + func track() { var eventDataProperties: Properties = MPEvent.eventData(type: .other, name: "") eventDataProperties["Location"] = "Tracker Page" diff --git a/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift index c06bbb9..269503e 100644 --- a/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift +++ b/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift @@ -21,6 +21,10 @@ internal class LifetimeValueIncreasingAction: TrackerAction { self.engine = engine } + func isActionAvailable(provider: AnalyticsTracking) -> Bool { + return provider is LifetimeValueIncreasing + } + func track() { let properties: Properties = ["Location" : "Tracker Page"] engine.trackLifetimeIncrease(byAmount: 1, diff --git a/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift index 8e8376d..8bf5c3c 100644 --- a/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift +++ b/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift @@ -22,6 +22,10 @@ internal class LocationTrackingAction: TrackerAction { self.engine = engine } + func isActionAvailable(provider: AnalyticsTracking) -> Bool { + return provider is LocationTracking + } + func track() { let properties: Properties = ["Location" : "Tracker Page"] let location = CLLocation(latitude: 40.7128, longitude: 74.0059) diff --git a/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift index 0e2f3cd..06b9faa 100644 --- a/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift +++ b/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift @@ -22,6 +22,10 @@ internal class PageViewTrackingAction: TrackerAction { self.engine = engine } + func isActionAvailable(provider: AnalyticsTracking) -> Bool { + return provider is PageViewTracking + } + func track() { let properties: Properties = ["Location" : "Tracker Page"] engine.track(pageView: "Tracker Selection Page View", withAdditionalProperties: properties) From fa23b7449e1ae10070278ccaec2a3cbd19eb311b Mon Sep 17 00:00:00 2001 From: Jonathan Samudio Date: Thu, 23 Feb 2017 17:54:58 -0500 Subject: [PATCH 08/11] Updated project with other tracker actions. --- .../SimcoeExample.xcodeproj/project.pbxproj | 81 +++++++++++++++++ .../SimcoeAnalyticsEngine.swift | 28 ++++++ .../AnalyticsDisplayViewController.swift | 91 +++---------------- SimcoeExample/SimcoeExample/AppDelegate.swift | 28 +----- .../SimcoeExample/Base.lproj/Main.storyboard | 22 +---- .../Builders/AnalyticsDisplayBuilder.swift | 41 +++++++++ .../Extensions/UIStoryboardExtension.swift | 24 +++++ .../UIViewControllerExtension.swift | 16 ++++ .../Helper Classes/AnalyticsProviders.swift | 36 ++++++++ .../Helper Classes/AvailableTrackers.swift | 32 +++++++ .../Helper Classes/SampleProduct.swift | 17 ++++ .../TrackerActionGenerator.swift | 38 ++++++++ .../Protocols/ActionGenerator.swift | 15 +++ .../Protocols/AnalyticsEngine.swift | 14 +++ .../Protocols/TrackerAction.swift | 6 ++ .../SimcoeExampleApplication.swift | 23 +++++ .../AddToCartLoggingAction.swift | 31 +++++++ .../CheckoutTrackingAction.swift | 31 +++++++ .../TrackerActions/ErrorLoggingAction.swift | 31 +++++++ .../LifetimeValueIncreasingAction.swift | 3 +- .../LocationTrackingAction.swift | 3 +- .../PageViewTrackingAction.swift | 4 +- .../PurchaseTrackingAction.swift | 32 +++++++ .../TrackerActions/RemoveFromCartAction.swift | 31 +++++++ .../UserAttributeTrackingAction.swift | 32 +++++++ .../ViewDetailLoggingAction.swift | 32 +++++++ .../TrackerTableViewController.swift | 12 ++- 27 files changed, 618 insertions(+), 136 deletions(-) create mode 100644 SimcoeExample/SimcoeExample/Builders/AnalyticsDisplayBuilder.swift create mode 100644 SimcoeExample/SimcoeExample/Extensions/UIStoryboardExtension.swift create mode 100644 SimcoeExample/SimcoeExample/Extensions/UIViewControllerExtension.swift create mode 100644 SimcoeExample/SimcoeExample/Helper Classes/AnalyticsProviders.swift create mode 100644 SimcoeExample/SimcoeExample/Helper Classes/AvailableTrackers.swift create mode 100644 SimcoeExample/SimcoeExample/Helper Classes/SampleProduct.swift create mode 100644 SimcoeExample/SimcoeExample/Helper Classes/TrackerActionGenerator.swift create mode 100644 SimcoeExample/SimcoeExample/Protocols/ActionGenerator.swift create mode 100644 SimcoeExample/SimcoeExample/SimcoeExampleApplication.swift create mode 100644 SimcoeExample/SimcoeExample/TrackerActions/AddToCartLoggingAction.swift create mode 100644 SimcoeExample/SimcoeExample/TrackerActions/CheckoutTrackingAction.swift create mode 100644 SimcoeExample/SimcoeExample/TrackerActions/ErrorLoggingAction.swift create mode 100644 SimcoeExample/SimcoeExample/TrackerActions/PurchaseTrackingAction.swift create mode 100644 SimcoeExample/SimcoeExample/TrackerActions/RemoveFromCartAction.swift create mode 100644 SimcoeExample/SimcoeExample/TrackerActions/UserAttributeTrackingAction.swift create mode 100644 SimcoeExample/SimcoeExample/TrackerActions/ViewDetailLoggingAction.swift diff --git a/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj b/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj index d142e42..4fe1c59 100644 --- a/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj +++ b/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj @@ -15,6 +15,22 @@ 200562EC1E5DEA530015AD55 /* SimcoeAnalyticsEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562EB1E5DEA530015AD55 /* SimcoeAnalyticsEngine.swift */; }; 200562EE1E5DEA780015AD55 /* AnalyticsEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562ED1E5DEA780015AD55 /* AnalyticsEngine.swift */; }; 200562F11E5DEAB20015AD55 /* AnalyticsTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562F01E5DEAB20015AD55 /* AnalyticsTracker.swift */; }; + 200562F31E5F43B10015AD55 /* AddToCartLoggingAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562F21E5F43B10015AD55 /* AddToCartLoggingAction.swift */; }; + 200562F51E5F45460015AD55 /* RemoveFromCartAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562F41E5F45460015AD55 /* RemoveFromCartAction.swift */; }; + 200562F71E5F56030015AD55 /* CheckoutTrackingAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562F61E5F56030015AD55 /* CheckoutTrackingAction.swift */; }; + 200562F91E5F56D50015AD55 /* ErrorLoggingAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562F81E5F56D50015AD55 /* ErrorLoggingAction.swift */; }; + 200562FB1E5F577D0015AD55 /* PurchaseTrackingAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562FA1E5F577D0015AD55 /* PurchaseTrackingAction.swift */; }; + 200562FD1E5F57EC0015AD55 /* UserAttributeTrackingAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562FC1E5F57EC0015AD55 /* UserAttributeTrackingAction.swift */; }; + 200562FF1E5F584B0015AD55 /* ViewDetailLoggingAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200562FE1E5F584B0015AD55 /* ViewDetailLoggingAction.swift */; }; + 200563011E5F597B0015AD55 /* SampleProduct.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563001E5F597B0015AD55 /* SampleProduct.swift */; }; + 200563031E5F5F4A0015AD55 /* TrackerActionGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563021E5F5F4A0015AD55 /* TrackerActionGenerator.swift */; }; + 200563051E5F5F5F0015AD55 /* ActionGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563041E5F5F5F0015AD55 /* ActionGenerator.swift */; }; + 200563071E5F87030015AD55 /* AvailableTrackers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563061E5F87030015AD55 /* AvailableTrackers.swift */; }; + 200563091E5F87230015AD55 /* AnalyticsProviders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563081E5F87230015AD55 /* AnalyticsProviders.swift */; }; + 2005630C1E5F8A880015AD55 /* UIViewControllerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2005630B1E5F8A880015AD55 /* UIViewControllerExtension.swift */; }; + 2005630E1E5F8A9C0015AD55 /* UIStoryboardExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2005630D1E5F8A9C0015AD55 /* UIStoryboardExtension.swift */; }; + 200563121E5F9D630015AD55 /* AnalyticsDisplayBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563111E5F9D630015AD55 /* AnalyticsDisplayBuilder.swift */; }; + 200563141E5F9E770015AD55 /* SimcoeExampleApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563131E5F9E770015AD55 /* SimcoeExampleApplication.swift */; }; 20C3B1B11E5CE6F70095F185 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */; }; 20C3B1B61E5CE6F70095F185 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B41E5CE6F70095F185 /* Main.storyboard */; }; 20C3B1B81E5CE6F70095F185 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */; }; @@ -45,6 +61,22 @@ 200562EB1E5DEA530015AD55 /* SimcoeAnalyticsEngine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimcoeAnalyticsEngine.swift; sourceTree = ""; }; 200562ED1E5DEA780015AD55 /* AnalyticsEngine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnalyticsEngine.swift; sourceTree = ""; }; 200562F01E5DEAB20015AD55 /* AnalyticsTracker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnalyticsTracker.swift; sourceTree = ""; }; + 200562F21E5F43B10015AD55 /* AddToCartLoggingAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddToCartLoggingAction.swift; sourceTree = ""; }; + 200562F41E5F45460015AD55 /* RemoveFromCartAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemoveFromCartAction.swift; sourceTree = ""; }; + 200562F61E5F56030015AD55 /* CheckoutTrackingAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckoutTrackingAction.swift; sourceTree = ""; }; + 200562F81E5F56D50015AD55 /* ErrorLoggingAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ErrorLoggingAction.swift; sourceTree = ""; }; + 200562FA1E5F577D0015AD55 /* PurchaseTrackingAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PurchaseTrackingAction.swift; sourceTree = ""; }; + 200562FC1E5F57EC0015AD55 /* UserAttributeTrackingAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserAttributeTrackingAction.swift; sourceTree = ""; }; + 200562FE1E5F584B0015AD55 /* ViewDetailLoggingAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewDetailLoggingAction.swift; sourceTree = ""; }; + 200563001E5F597B0015AD55 /* SampleProduct.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SampleProduct.swift; sourceTree = ""; }; + 200563021E5F5F4A0015AD55 /* TrackerActionGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrackerActionGenerator.swift; sourceTree = ""; }; + 200563041E5F5F5F0015AD55 /* ActionGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionGenerator.swift; sourceTree = ""; }; + 200563061E5F87030015AD55 /* AvailableTrackers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvailableTrackers.swift; sourceTree = ""; }; + 200563081E5F87230015AD55 /* AnalyticsProviders.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnalyticsProviders.swift; sourceTree = ""; }; + 2005630B1E5F8A880015AD55 /* UIViewControllerExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIViewControllerExtension.swift; sourceTree = ""; }; + 2005630D1E5F8A9C0015AD55 /* UIStoryboardExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIStoryboardExtension.swift; sourceTree = ""; }; + 200563111E5F9D630015AD55 /* AnalyticsDisplayBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnalyticsDisplayBuilder.swift; sourceTree = ""; }; + 200563131E5F9E770015AD55 /* SimcoeExampleApplication.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimcoeExampleApplication.swift; sourceTree = ""; }; 20C3B1AD1E5CE6F70095F185 /* SimcoeExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimcoeExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 20C3B1B51E5CE6F70095F185 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -88,6 +120,13 @@ 200562E41E5DE5CC0015AD55 /* LifetimeValueIncreasingAction.swift */, 200562E61E5DE5DD0015AD55 /* LocationTrackingAction.swift */, 200562E81E5DE5EB0015AD55 /* PageViewTrackingAction.swift */, + 200562F21E5F43B10015AD55 /* AddToCartLoggingAction.swift */, + 200562F41E5F45460015AD55 /* RemoveFromCartAction.swift */, + 200562F61E5F56030015AD55 /* CheckoutTrackingAction.swift */, + 200562F81E5F56D50015AD55 /* ErrorLoggingAction.swift */, + 200562FA1E5F577D0015AD55 /* PurchaseTrackingAction.swift */, + 200562FC1E5F57EC0015AD55 /* UserAttributeTrackingAction.swift */, + 200562FE1E5F584B0015AD55 /* ViewDetailLoggingAction.swift */, ); path = TrackerActions; sourceTree = ""; @@ -97,6 +136,7 @@ children = ( 200562E01E5DE5A60015AD55 /* TrackerAction.swift */, 200562ED1E5DEA780015AD55 /* AnalyticsEngine.swift */, + 200563041E5F5F5F0015AD55 /* ActionGenerator.swift */, ); path = Protocols; sourceTree = ""; @@ -113,14 +153,37 @@ isa = PBXGroup; children = ( 200562F01E5DEAB20015AD55 /* AnalyticsTracker.swift */, + 200563001E5F597B0015AD55 /* SampleProduct.swift */, + 200563021E5F5F4A0015AD55 /* TrackerActionGenerator.swift */, + 200563061E5F87030015AD55 /* AvailableTrackers.swift */, + 200563081E5F87230015AD55 /* AnalyticsProviders.swift */, ); path = "Helper Classes"; sourceTree = ""; }; + 2005630A1E5F8A7B0015AD55 /* Extensions */ = { + isa = PBXGroup; + children = ( + 2005630B1E5F8A880015AD55 /* UIViewControllerExtension.swift */, + 2005630D1E5F8A9C0015AD55 /* UIStoryboardExtension.swift */, + ); + name = Extensions; + path = SimcoeExample/Extensions; + sourceTree = ""; + }; + 200563101E5F9D550015AD55 /* Builders */ = { + isa = PBXGroup; + children = ( + 200563111E5F9D630015AD55 /* AnalyticsDisplayBuilder.swift */, + ); + path = Builders; + sourceTree = ""; + }; 20C3B1A41E5CE6F70095F185 = { isa = PBXGroup; children = ( 20C3B1AF1E5CE6F70095F185 /* SimcoeExample */, + 2005630A1E5F8A7B0015AD55 /* Extensions */, 20C3B1C41E5CE6F80095F185 /* SimcoeExampleTests */, 20C3B1AE1E5CE6F70095F185 /* Products */, C7C320D69EA0D1C563FF3995 /* Pods */, @@ -141,6 +204,7 @@ isa = PBXGroup; children = ( 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */, + 200563131E5F9E770015AD55 /* SimcoeExampleApplication.swift */, 20C3B1D01E5CE7D70095F185 /* AnalyticsDisplayViewController.swift */, 20C3B1D21E5CED6C0095F185 /* TrackerTableViewController.swift */, 20C3B1B41E5CE6F70095F185 /* Main.storyboard */, @@ -152,6 +216,7 @@ 200562DE1E5DE59A0015AD55 /* TrackerActions */, 200562DF1E5DE59A0015AD55 /* Protocols */, 200562EF1E5DEAAB0015AD55 /* Helper Classes */, + 200563101E5F9D550015AD55 /* Builders */, ); path = SimcoeExample; sourceTree = ""; @@ -341,13 +406,29 @@ files = ( 200562E91E5DE5EB0015AD55 /* PageViewTrackingAction.swift in Sources */, 200562E11E5DE5A60015AD55 /* TrackerAction.swift in Sources */, + 200563011E5F597B0015AD55 /* SampleProduct.swift in Sources */, 200562E51E5DE5CC0015AD55 /* LifetimeValueIncreasingAction.swift in Sources */, + 200563031E5F5F4A0015AD55 /* TrackerActionGenerator.swift in Sources */, + 200562FB1E5F577D0015AD55 /* PurchaseTrackingAction.swift in Sources */, 20C3B1D31E5CED6C0095F185 /* TrackerTableViewController.swift in Sources */, + 2005630E1E5F8A9C0015AD55 /* UIStoryboardExtension.swift in Sources */, 200562EE1E5DEA780015AD55 /* AnalyticsEngine.swift in Sources */, + 200562F91E5F56D50015AD55 /* ErrorLoggingAction.swift in Sources */, 200562EC1E5DEA530015AD55 /* SimcoeAnalyticsEngine.swift in Sources */, + 200562F31E5F43B10015AD55 /* AddToCartLoggingAction.swift in Sources */, 200562E31E5DE5BA0015AD55 /* EventTrackerAction.swift in Sources */, + 200563071E5F87030015AD55 /* AvailableTrackers.swift in Sources */, + 200563051E5F5F5F0015AD55 /* ActionGenerator.swift in Sources */, 200562E71E5DE5DD0015AD55 /* LocationTrackingAction.swift in Sources */, + 200562F51E5F45460015AD55 /* RemoveFromCartAction.swift in Sources */, + 200562FD1E5F57EC0015AD55 /* UserAttributeTrackingAction.swift in Sources */, + 200562FF1E5F584B0015AD55 /* ViewDetailLoggingAction.swift in Sources */, + 200563091E5F87230015AD55 /* AnalyticsProviders.swift in Sources */, + 200562F71E5F56030015AD55 /* CheckoutTrackingAction.swift in Sources */, + 200563141E5F9E770015AD55 /* SimcoeExampleApplication.swift in Sources */, + 2005630C1E5F8A880015AD55 /* UIViewControllerExtension.swift in Sources */, 20C3B1D11E5CE7D70095F185 /* AnalyticsDisplayViewController.swift in Sources */, + 200563121E5F9D630015AD55 /* AnalyticsDisplayBuilder.swift in Sources */, 200562F11E5DEAB20015AD55 /* AnalyticsTracker.swift in Sources */, 20C3B1B11E5CE6F70095F185 /* AppDelegate.swift in Sources */, ); diff --git a/SimcoeExample/SimcoeExample/Analytics Engine/SimcoeAnalyticsEngine.swift b/SimcoeExample/SimcoeExample/Analytics Engine/SimcoeAnalyticsEngine.swift index eedfb7a..3faca6a 100644 --- a/SimcoeExample/SimcoeExample/Analytics Engine/SimcoeAnalyticsEngine.swift +++ b/SimcoeExample/SimcoeExample/Analytics Engine/SimcoeAnalyticsEngine.swift @@ -34,4 +34,32 @@ internal class SimcoeAnalyticsEngine: AnalyticsEngine { func track(pageView: String, withAdditionalProperties properties: Properties?) { Simcoe.track(pageView: pageView, withAdditionalProperties: properties) } + + func logAddToCart(_ product: T, eventProperties: Properties?) { + Simcoe.logAddToCart(product, eventProperties: eventProperties) + } + + func logRemoveFromCart(_ product: T, eventProperties: Properties?) { + Simcoe.logRemoveFromCart(product, eventProperties: eventProperties) + } + + func trackCheckoutEvent(_ products: [T], eventProperties: Properties?) { + Simcoe.trackCheckoutEvent(products, eventProperties: eventProperties) + } + + func log(error: String, withAdditionalProperties properties: Properties?) { + Simcoe.log(error: error, withAdditionalProperties: properties) + } + + func trackPurchaseEvent(_ products: [T], eventProperties: Properties?) { + Simcoe.trackPurchaseEvent(products, eventProperties: eventProperties) + } + + func setUserAttribute(_ key: String, value: AnyObject) { + Simcoe.setUserAttribute(key, value: value) + } + + func logViewDetail(_ product: T, eventProperties: Properties?) { + Simcoe.logViewDetail(product, eventProperties: eventProperties) + } } diff --git a/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift b/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift index 7efc143..5a61c9d 100644 --- a/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift +++ b/SimcoeExample/SimcoeExample/AnalyticsDisplayViewController.swift @@ -7,93 +7,23 @@ // import UIKit -import Simcoe -import CoreLocation -import mParticle_Apple_SDK - -internal protocol ActionGenerator { - - func trackerActions(providers: [AnalyticsTracking]) -> [TrackerAction] - -} - -internal final class TrackerActionGenerator: ActionGenerator { - - private var engine: AnalyticsEngine - - private var availableTrackerActions: [TrackerAction] - - init(engine: AnalyticsEngine, availableTrackerActions: [TrackerAction]) { - self.engine = engine - self.availableTrackerActions = availableTrackerActions - } - - func trackerActions(providers: [AnalyticsTracking]) -> [TrackerAction] { - var actions: [TrackerAction] = [] - - for provider in providers { - for action in availableTrackerActions { - if action.isActionAvailable(provider: provider) == true && - action.isContainedIn(actions: actions) == false { - - actions.append(action) - } - } - } - - return actions - } -} internal final class AnalyticsDisplayViewController: UITableViewController { - var providers: [AnalyticsTracker] = [] - - lazy var analyticsEngine: AnalyticsEngine = { - return SimcoeAnalyticsEngine() - }() + var analyticsEngine: AnalyticsEngine! - override func viewDidLoad() { - super.viewDidLoad() - - let particle = mParticle(key: "mikesaidtomakeafakeone", secret: "hiyoseob") - let adobe = Adobe() - - setupTrackers(providers: [adobe], name: adobe.name) - setupTrackers(providers: [particle], name: particle.name) - setupTrackers(providers: [adobe, particle], name: "All Analytics Trackers") - setupTrackers(providers: [], name: "None") - } - - private func setupTrackers(providers: [AnalyticsTracking], name: String) { - - let availableActions: [TrackerAction] = [EventTrackerAction(engine: analyticsEngine), - LocationTrackingAction(engine: analyticsEngine), - LifetimeValueIncreasingAction(engine: analyticsEngine), - PageViewTrackingAction(engine: analyticsEngine)] - - guard !providers.isEmpty else { - self.providers.append(AnalyticsTracker(providers: providers, actions: availableActions, name: name)) - return - } - - - let actionGenerator = TrackerActionGenerator(engine: analyticsEngine, availableTrackerActions: availableActions) - let actions = actionGenerator.trackerActions(providers: providers) - - self.providers.append(AnalyticsTracker(providers: providers, actions: actions, name: name)) - } + var providers: AnalyticsProviders! } extension AnalyticsDisplayViewController { override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return providers.count + return providers.trackers.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = UITableViewCell() - cell.textLabel?.text = providers[indexPath.row].name + cell.textLabel?.text = providers.trackers[indexPath.row].name cell.accessoryType = .disclosureIndicator return cell } @@ -101,11 +31,18 @@ extension AnalyticsDisplayViewController { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView.deselectRow(at: indexPath, animated: true) - let trackerVC = TrackerTableViewController.storyboardInit() + let trackerVC: TrackerTableViewController = TrackerTableViewController.storyboardInit() - analyticsEngine.run(with: providers[indexPath.row].providers) + analyticsEngine.run(with: providers.trackers[indexPath.row].providers) - trackerVC.trackers = providers[indexPath.row].actions + trackerVC.trackers = providers.trackers[indexPath.row].actions navigationController?.pushViewController(trackerVC, animated: true) } } + +extension AnalyticsDisplayViewController { + + static func storyboardInit() -> T { + return UIStoryboard.mainStoryboard.instantiateViewController(AnalyticsDisplayViewController.storyboardID) + } +} diff --git a/SimcoeExample/SimcoeExample/AppDelegate.swift b/SimcoeExample/SimcoeExample/AppDelegate.swift index 48653b7..ed0eb82 100644 --- a/SimcoeExample/SimcoeExample/AppDelegate.swift +++ b/SimcoeExample/SimcoeExample/AppDelegate.swift @@ -13,34 +13,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. + window = SimcoeExampleApplication().startWindow() return true } - - func applicationWillResignActive(_ application: UIApplication) { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. - } - - func applicationDidEnterBackground(_ application: UIApplication) { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. - } - - func applicationWillEnterForeground(_ application: UIApplication) { - // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. - } - - func applicationDidBecomeActive(_ application: UIApplication) { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - } - - func applicationWillTerminate(_ application: UIApplication) { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. - } - - } - diff --git a/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard b/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard index 4f9e1f7..7639b05 100644 --- a/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard +++ b/SimcoeExample/SimcoeExample/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -28,23 +28,5 @@ - - - - - - - - - - - - - - - - - - diff --git a/SimcoeExample/SimcoeExample/Builders/AnalyticsDisplayBuilder.swift b/SimcoeExample/SimcoeExample/Builders/AnalyticsDisplayBuilder.swift new file mode 100644 index 0000000..32ba8f9 --- /dev/null +++ b/SimcoeExample/SimcoeExample/Builders/AnalyticsDisplayBuilder.swift @@ -0,0 +1,41 @@ +// +// AnalyticsDisplayBuilder.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation +import Simcoe + +internal class AnalyticsDisplayBuilder { + + let analyticsEngine: AnalyticsEngine = SimcoeAnalyticsEngine() + + lazy var availableTrackers: AvailableTrackers = { + return AvailableTrackers(engine: self.analyticsEngine) + }() + + lazy var providers: AnalyticsProviders = { + return AnalyticsProviders(engine: self.analyticsEngine, availableActions: self.availableTrackers.actions) + }() + + init() { + let particle = mParticle(key: "mikesaidtomakeafakeone", secret: "hiyoseob") + let adobe = Adobe() + + providers.addTracker(name: adobe.name, providers: [adobe]) + providers.addTracker(name: particle.name, providers: [particle]) + providers.addTracker(name: "All Analytics Trackers", providers: [adobe, particle]) + providers.addTracker(name: "None", providers: []) + } + + func analyticsDisplayViewController() -> AnalyticsDisplayViewController { + let rootViewController: AnalyticsDisplayViewController = AnalyticsDisplayViewController.storyboardInit() + rootViewController.analyticsEngine = analyticsEngine + rootViewController.providers = providers + + return rootViewController + } +} diff --git a/SimcoeExample/SimcoeExample/Extensions/UIStoryboardExtension.swift b/SimcoeExample/SimcoeExample/Extensions/UIStoryboardExtension.swift new file mode 100644 index 0000000..7ae9d97 --- /dev/null +++ b/SimcoeExample/SimcoeExample/Extensions/UIStoryboardExtension.swift @@ -0,0 +1,24 @@ +// +// UIStoryboardExtension.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import UIKit + +extension UIStoryboard { + + static var mainStoryboard: UIStoryboard { + return UIStoryboard(name: "Main", bundle: nil) + } + + static var trackerStoryboard: UIStoryboard { + return UIStoryboard(name: "Tracker", bundle: nil) + } + + func instantiateViewController(_ identifier: String) -> T { + return self.instantiateViewController(withIdentifier: identifier) as! T + } +} diff --git a/SimcoeExample/SimcoeExample/Extensions/UIViewControllerExtension.swift b/SimcoeExample/SimcoeExample/Extensions/UIViewControllerExtension.swift new file mode 100644 index 0000000..d02ee05 --- /dev/null +++ b/SimcoeExample/SimcoeExample/Extensions/UIViewControllerExtension.swift @@ -0,0 +1,16 @@ +// +// UIViewControllerExtension.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import UIKit + +extension UIViewController { + + static var storyboardID: String { + return String(describing: self) + } +} diff --git a/SimcoeExample/SimcoeExample/Helper Classes/AnalyticsProviders.swift b/SimcoeExample/SimcoeExample/Helper Classes/AnalyticsProviders.swift new file mode 100644 index 0000000..be058ca --- /dev/null +++ b/SimcoeExample/SimcoeExample/Helper Classes/AnalyticsProviders.swift @@ -0,0 +1,36 @@ +// +// AnalyticsProviders.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation +import Simcoe + +internal class AnalyticsProviders { + + var trackers: [AnalyticsTracker] = [] + + private let availableActions: [TrackerAction] + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine, availableActions: [TrackerAction]) { + self.engine = engine + self.availableActions = availableActions + } + + func addTracker(name: String, providers: [AnalyticsTracking]) { + guard !providers.isEmpty else { + self.trackers.append(AnalyticsTracker(providers: providers, actions: availableActions, name: name)) + return + } + + let actionGenerator = TrackerActionGenerator(engine: engine, availableTrackerActions: availableActions) + let actions = actionGenerator.trackerActions(providers: providers) + + self.trackers.append(AnalyticsTracker(providers: providers, actions: actions, name: name)) + } +} diff --git a/SimcoeExample/SimcoeExample/Helper Classes/AvailableTrackers.swift b/SimcoeExample/SimcoeExample/Helper Classes/AvailableTrackers.swift new file mode 100644 index 0000000..cf7b9cf --- /dev/null +++ b/SimcoeExample/SimcoeExample/Helper Classes/AvailableTrackers.swift @@ -0,0 +1,32 @@ +// +// AvailableTrackers.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation + +internal class AvailableTrackers { + + lazy var actions: [TrackerAction] = { + return [EventTrackerAction(engine: self.engine), + LocationTrackingAction(engine: self.engine), + LifetimeValueIncreasingAction(engine: self.engine), + PageViewTrackingAction(engine: self.engine), + AddToCartLoggingAction(engine: self.engine), + RemoveFromCartAction(engine: self.engine), + CheckoutTrackingAction(engine: self.engine), + ErrorLoggingAction(engine: self.engine), + PurchaseTrackingAction(engine: self.engine), + UserAttributeTrackingAction(engine: self.engine), + ViewDetailLoggingAction(engine: self.engine)] + }() + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine) { + self.engine = engine + } +} diff --git a/SimcoeExample/SimcoeExample/Helper Classes/SampleProduct.swift b/SimcoeExample/SimcoeExample/Helper Classes/SampleProduct.swift new file mode 100644 index 0000000..c455d5f --- /dev/null +++ b/SimcoeExample/SimcoeExample/Helper Classes/SampleProduct.swift @@ -0,0 +1,17 @@ +// +// SampleProduct.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation +import Simcoe + +struct SampleProduct: SimcoeProductConvertible { + + func toSimcoeProduct() -> SimcoeProduct { + return SimcoeProduct(productName: "Fancy Dress", productId: "256489", quantity: 2, price: 100, properties: nil) + } +} diff --git a/SimcoeExample/SimcoeExample/Helper Classes/TrackerActionGenerator.swift b/SimcoeExample/SimcoeExample/Helper Classes/TrackerActionGenerator.swift new file mode 100644 index 0000000..9fecc9f --- /dev/null +++ b/SimcoeExample/SimcoeExample/Helper Classes/TrackerActionGenerator.swift @@ -0,0 +1,38 @@ +// +// TrackerActionGenerator.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation +import Simcoe + +internal final class TrackerActionGenerator: ActionGenerator { + + private var engine: AnalyticsEngine + + private var availableTrackerActions: [TrackerAction] + + init(engine: AnalyticsEngine, availableTrackerActions: [TrackerAction]) { + self.engine = engine + self.availableTrackerActions = availableTrackerActions + } + + func trackerActions(providers: [AnalyticsTracking]) -> [TrackerAction] { + var actions: [TrackerAction] = [] + + for provider in providers { + for action in availableTrackerActions { + if action.isActionAvailable(provider: provider) == true && + action.isContainedIn(actions: actions) == false { + + actions.append(action) + } + } + } + + return actions + } +} diff --git a/SimcoeExample/SimcoeExample/Protocols/ActionGenerator.swift b/SimcoeExample/SimcoeExample/Protocols/ActionGenerator.swift new file mode 100644 index 0000000..06e31bf --- /dev/null +++ b/SimcoeExample/SimcoeExample/Protocols/ActionGenerator.swift @@ -0,0 +1,15 @@ +// +// ActionGenerator.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation +import Simcoe + +internal protocol ActionGenerator { + + func trackerActions(providers: [AnalyticsTracking]) -> [TrackerAction] +} diff --git a/SimcoeExample/SimcoeExample/Protocols/AnalyticsEngine.swift b/SimcoeExample/SimcoeExample/Protocols/AnalyticsEngine.swift index f3cbdf0..1cdf23a 100644 --- a/SimcoeExample/SimcoeExample/Protocols/AnalyticsEngine.swift +++ b/SimcoeExample/SimcoeExample/Protocols/AnalyticsEngine.swift @@ -23,4 +23,18 @@ internal protocol AnalyticsEngine { func track(location: CLLocation, withAdditionalProperties properties: Properties?) func track(pageView: String, withAdditionalProperties properties: Properties?) + + func logAddToCart(_ product: T, eventProperties: Properties?) + + func logRemoveFromCart(_ product: T, eventProperties: Properties?) + + func trackCheckoutEvent(_ products: [T], eventProperties: Properties?) + + func log(error: String, withAdditionalProperties properties: Properties?) + + func trackPurchaseEvent(_ products: [T], eventProperties: Properties?) + + func setUserAttribute(_ key: String, value: AnyObject) + + func logViewDetail(_ product: T, eventProperties: Properties?) } diff --git a/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift b/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift index c804601..df58981 100644 --- a/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift +++ b/SimcoeExample/SimcoeExample/Protocols/TrackerAction.swift @@ -13,6 +13,8 @@ internal protocol TrackerAction { var name: String { get } + var defaultProperties: Properties { get } + func isActionAvailable(provider: AnalyticsTracking) -> Bool func track() @@ -22,6 +24,10 @@ internal protocol TrackerAction { extension TrackerAction { + var defaultProperties: Properties { + return ["Location" : "Tracker Page"] + } + func isContainedIn(actions: [TrackerAction]) -> Bool { return actions.contains(where: { (arrayAction) -> Bool in return name == arrayAction.name diff --git a/SimcoeExample/SimcoeExample/SimcoeExampleApplication.swift b/SimcoeExample/SimcoeExample/SimcoeExampleApplication.swift new file mode 100644 index 0000000..3bab547 --- /dev/null +++ b/SimcoeExample/SimcoeExample/SimcoeExampleApplication.swift @@ -0,0 +1,23 @@ +// +// SimcoeExampleApplication.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import UIKit + +internal class SimcoeExampleApplication { + + func startWindow() -> UIWindow { + let window = UIWindow() + + let rootViewController = AnalyticsDisplayBuilder().analyticsDisplayViewController() + let navigationViewController = UINavigationController(rootViewController: rootViewController) + + window.rootViewController = navigationViewController + + return window + } +} diff --git a/SimcoeExample/SimcoeExample/TrackerActions/AddToCartLoggingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/AddToCartLoggingAction.swift new file mode 100644 index 0000000..12e2a79 --- /dev/null +++ b/SimcoeExample/SimcoeExample/TrackerActions/AddToCartLoggingAction.swift @@ -0,0 +1,31 @@ +// +// AddToCartLoggingAction.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation +import Simcoe + +internal final class AddToCartLoggingAction: TrackerAction { + + var name: String { + return "Track Add to Cart Logging" + } + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine) { + self.engine = engine + } + + func isActionAvailable(provider: AnalyticsTracking) -> Bool { + return provider is CartLogging + } + + func track() { + engine.logAddToCart(SampleProduct(), eventProperties: defaultProperties) + } +} diff --git a/SimcoeExample/SimcoeExample/TrackerActions/CheckoutTrackingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/CheckoutTrackingAction.swift new file mode 100644 index 0000000..cb8ee2a --- /dev/null +++ b/SimcoeExample/SimcoeExample/TrackerActions/CheckoutTrackingAction.swift @@ -0,0 +1,31 @@ +// +// CheckoutTrackingAction.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation +import Simcoe + +internal final class CheckoutTrackingAction: TrackerAction { + + var name: String { + return "Track Checkout Event" + } + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine) { + self.engine = engine + } + + func isActionAvailable(provider: AnalyticsTracking) -> Bool { + return provider is CheckoutTracking + } + + func track() { + engine.trackCheckoutEvent([SampleProduct()], eventProperties: defaultProperties) + } +} diff --git a/SimcoeExample/SimcoeExample/TrackerActions/ErrorLoggingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/ErrorLoggingAction.swift new file mode 100644 index 0000000..e856a9a --- /dev/null +++ b/SimcoeExample/SimcoeExample/TrackerActions/ErrorLoggingAction.swift @@ -0,0 +1,31 @@ +// +// ErrorLoggingAction.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation +import Simcoe + +internal final class ErrorLoggingAction: TrackerAction { + + var name: String { + return "Track Error Logging" + } + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine) { + self.engine = engine + } + + func isActionAvailable(provider: AnalyticsTracking) -> Bool { + return provider is ErrorLogging + } + + func track() { + engine.log(error: "Sample Error Message", withAdditionalProperties: defaultProperties) + } +} diff --git a/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift index 269503e..3f3c069 100644 --- a/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift +++ b/SimcoeExample/SimcoeExample/TrackerActions/LifetimeValueIncreasingAction.swift @@ -26,9 +26,8 @@ internal class LifetimeValueIncreasingAction: TrackerAction { } func track() { - let properties: Properties = ["Location" : "Tracker Page"] engine.trackLifetimeIncrease(byAmount: 1, forItem: "Track Lifetime Value Tapped", - withAdditionalProperties: properties) + withAdditionalProperties: defaultProperties) } } diff --git a/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift index 8bf5c3c..66c0e2e 100644 --- a/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift +++ b/SimcoeExample/SimcoeExample/TrackerActions/LocationTrackingAction.swift @@ -27,8 +27,7 @@ internal class LocationTrackingAction: TrackerAction { } func track() { - let properties: Properties = ["Location" : "Tracker Page"] let location = CLLocation(latitude: 40.7128, longitude: 74.0059) - engine.track(location: location, withAdditionalProperties: properties) + engine.track(location: location, withAdditionalProperties: defaultProperties) } } diff --git a/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift index 06b9faa..6230ad4 100644 --- a/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift +++ b/SimcoeExample/SimcoeExample/TrackerActions/PageViewTrackingAction.swift @@ -8,7 +8,6 @@ import Foundation import Simcoe -import CoreLocation internal class PageViewTrackingAction: TrackerAction { @@ -27,7 +26,6 @@ internal class PageViewTrackingAction: TrackerAction { } func track() { - let properties: Properties = ["Location" : "Tracker Page"] - engine.track(pageView: "Tracker Selection Page View", withAdditionalProperties: properties) + engine.track(pageView: "Tracker Selection Page View", withAdditionalProperties: defaultProperties) } } diff --git a/SimcoeExample/SimcoeExample/TrackerActions/PurchaseTrackingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/PurchaseTrackingAction.swift new file mode 100644 index 0000000..53aadf2 --- /dev/null +++ b/SimcoeExample/SimcoeExample/TrackerActions/PurchaseTrackingAction.swift @@ -0,0 +1,32 @@ +// +// PurchaseTrackingAction.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation +import Simcoe + +internal final class PurchaseTrackingAction: TrackerAction { + + var name: String { + return "Track Purchase" + } + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine) { + self.engine = engine + } + + func isActionAvailable(provider: AnalyticsTracking) -> Bool { + return provider is PurchaseTracking + } + + func track() { + engine.trackPurchaseEvent([SampleProduct()], eventProperties: defaultProperties) + } +} + diff --git a/SimcoeExample/SimcoeExample/TrackerActions/RemoveFromCartAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/RemoveFromCartAction.swift new file mode 100644 index 0000000..1deac20 --- /dev/null +++ b/SimcoeExample/SimcoeExample/TrackerActions/RemoveFromCartAction.swift @@ -0,0 +1,31 @@ +// +// RemoveFromCartAction.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation +import Simcoe + +internal final class RemoveFromCartAction: TrackerAction { + + var name: String { + return "Track Remove from Cart Logging" + } + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine) { + self.engine = engine + } + + func isActionAvailable(provider: AnalyticsTracking) -> Bool { + return provider is CartLogging + } + + func track() { + engine.logRemoveFromCart(SampleProduct(), eventProperties: defaultProperties) + } +} diff --git a/SimcoeExample/SimcoeExample/TrackerActions/UserAttributeTrackingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/UserAttributeTrackingAction.swift new file mode 100644 index 0000000..c97e882 --- /dev/null +++ b/SimcoeExample/SimcoeExample/TrackerActions/UserAttributeTrackingAction.swift @@ -0,0 +1,32 @@ +// +// UserAttributeTrackingAction.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation +import Simcoe + +internal final class UserAttributeTrackingAction: TrackerAction { + + var name: String { + return "Track Set User Attribute" + } + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine) { + self.engine = engine + } + + func isActionAvailable(provider: AnalyticsTracking) -> Bool { + return provider is UserAttributeTracking + } + + func track() { + engine.setUserAttribute("Logged In Type", value: "Email" as AnyObject) + } +} + diff --git a/SimcoeExample/SimcoeExample/TrackerActions/ViewDetailLoggingAction.swift b/SimcoeExample/SimcoeExample/TrackerActions/ViewDetailLoggingAction.swift new file mode 100644 index 0000000..83db2bd --- /dev/null +++ b/SimcoeExample/SimcoeExample/TrackerActions/ViewDetailLoggingAction.swift @@ -0,0 +1,32 @@ +// +// ViewDetailLoggingAction.swift +// SimcoeExample +// +// Created by Jonathan Samudio on 2/23/17. +// Copyright © 2017 Prolific Interactive. All rights reserved. +// + +import Foundation +import Simcoe + +internal final class ViewDetailLoggingAction: TrackerAction { + + var name: String { + return "Track Purchase" + } + + private var engine: AnalyticsEngine + + init(engine: AnalyticsEngine) { + self.engine = engine + } + + func isActionAvailable(provider: AnalyticsTracking) -> Bool { + return provider is ViewDetailLogging + } + + func track() { + engine.logViewDetail(SampleProduct(), eventProperties: defaultProperties) + } +} + diff --git a/SimcoeExample/SimcoeExample/TrackerTableViewController.swift b/SimcoeExample/SimcoeExample/TrackerTableViewController.swift index ba16a0f..55d0443 100644 --- a/SimcoeExample/SimcoeExample/TrackerTableViewController.swift +++ b/SimcoeExample/SimcoeExample/TrackerTableViewController.swift @@ -12,11 +12,6 @@ import Simcoe internal final class TrackerTableViewController: UITableViewController { var trackers: [TrackerAction]! - - static func storyboardInit() -> TrackerTableViewController { - let storyBoard = UIStoryboard(name: "Tracker", bundle: nil) - return storyBoard.instantiateViewController(withIdentifier: "TrackerTableViewController") as! TrackerTableViewController - } } extension TrackerTableViewController { @@ -36,3 +31,10 @@ extension TrackerTableViewController { trackers[indexPath.row].track() } } + +extension TrackerTableViewController { + + static func storyboardInit() -> T { + return UIStoryboard.trackerStoryboard.instantiateViewController(TrackerTableViewController.storyboardID) + } +} From 1039fbc986064acd3fcd7083c2db6510d2e6f78e Mon Sep 17 00:00:00 2001 From: Jonathan Samudio Date: Thu, 23 Feb 2017 18:03:52 -0500 Subject: [PATCH 09/11] Moved extension folder location. --- .../SimcoeExample.xcodeproj/project.pbxproj | 29 +++++++++---------- .../AppIcon.appiconset/Contents.json | 10 +++++++ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj b/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj index 4fe1c59..b42118b 100644 --- a/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj +++ b/SimcoeExample/SimcoeExample.xcodeproj/project.pbxproj @@ -27,10 +27,10 @@ 200563051E5F5F5F0015AD55 /* ActionGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563041E5F5F5F0015AD55 /* ActionGenerator.swift */; }; 200563071E5F87030015AD55 /* AvailableTrackers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563061E5F87030015AD55 /* AvailableTrackers.swift */; }; 200563091E5F87230015AD55 /* AnalyticsProviders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563081E5F87230015AD55 /* AnalyticsProviders.swift */; }; - 2005630C1E5F8A880015AD55 /* UIViewControllerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2005630B1E5F8A880015AD55 /* UIViewControllerExtension.swift */; }; - 2005630E1E5F8A9C0015AD55 /* UIStoryboardExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2005630D1E5F8A9C0015AD55 /* UIStoryboardExtension.swift */; }; 200563121E5F9D630015AD55 /* AnalyticsDisplayBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563111E5F9D630015AD55 /* AnalyticsDisplayBuilder.swift */; }; 200563141E5F9E770015AD55 /* SimcoeExampleApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563131E5F9E770015AD55 /* SimcoeExampleApplication.swift */; }; + 200563181E5FA1BF0015AD55 /* UIStoryboardExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563161E5FA1BF0015AD55 /* UIStoryboardExtension.swift */; }; + 200563191E5FA1BF0015AD55 /* UIViewControllerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 200563171E5FA1BF0015AD55 /* UIViewControllerExtension.swift */; }; 20C3B1B11E5CE6F70095F185 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */; }; 20C3B1B61E5CE6F70095F185 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B41E5CE6F70095F185 /* Main.storyboard */; }; 20C3B1B81E5CE6F70095F185 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 20C3B1B71E5CE6F70095F185 /* Assets.xcassets */; }; @@ -73,10 +73,10 @@ 200563041E5F5F5F0015AD55 /* ActionGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionGenerator.swift; sourceTree = ""; }; 200563061E5F87030015AD55 /* AvailableTrackers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvailableTrackers.swift; sourceTree = ""; }; 200563081E5F87230015AD55 /* AnalyticsProviders.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnalyticsProviders.swift; sourceTree = ""; }; - 2005630B1E5F8A880015AD55 /* UIViewControllerExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIViewControllerExtension.swift; sourceTree = ""; }; - 2005630D1E5F8A9C0015AD55 /* UIStoryboardExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIStoryboardExtension.swift; sourceTree = ""; }; 200563111E5F9D630015AD55 /* AnalyticsDisplayBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnalyticsDisplayBuilder.swift; sourceTree = ""; }; 200563131E5F9E770015AD55 /* SimcoeExampleApplication.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimcoeExampleApplication.swift; sourceTree = ""; }; + 200563161E5FA1BF0015AD55 /* UIStoryboardExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIStoryboardExtension.swift; sourceTree = ""; }; + 200563171E5FA1BF0015AD55 /* UIViewControllerExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIViewControllerExtension.swift; sourceTree = ""; }; 20C3B1AD1E5CE6F70095F185 /* SimcoeExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimcoeExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20C3B1B01E5CE6F70095F185 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 20C3B1B51E5CE6F70095F185 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -161,29 +161,27 @@ path = "Helper Classes"; sourceTree = ""; }; - 2005630A1E5F8A7B0015AD55 /* Extensions */ = { + 200563101E5F9D550015AD55 /* Builders */ = { isa = PBXGroup; children = ( - 2005630B1E5F8A880015AD55 /* UIViewControllerExtension.swift */, - 2005630D1E5F8A9C0015AD55 /* UIStoryboardExtension.swift */, + 200563111E5F9D630015AD55 /* AnalyticsDisplayBuilder.swift */, ); - name = Extensions; - path = SimcoeExample/Extensions; + path = Builders; sourceTree = ""; }; - 200563101E5F9D550015AD55 /* Builders */ = { + 200563151E5FA1BF0015AD55 /* Extensions */ = { isa = PBXGroup; children = ( - 200563111E5F9D630015AD55 /* AnalyticsDisplayBuilder.swift */, + 200563161E5FA1BF0015AD55 /* UIStoryboardExtension.swift */, + 200563171E5FA1BF0015AD55 /* UIViewControllerExtension.swift */, ); - path = Builders; + path = Extensions; sourceTree = ""; }; 20C3B1A41E5CE6F70095F185 = { isa = PBXGroup; children = ( 20C3B1AF1E5CE6F70095F185 /* SimcoeExample */, - 2005630A1E5F8A7B0015AD55 /* Extensions */, 20C3B1C41E5CE6F80095F185 /* SimcoeExampleTests */, 20C3B1AE1E5CE6F70095F185 /* Products */, C7C320D69EA0D1C563FF3995 /* Pods */, @@ -217,6 +215,7 @@ 200562DF1E5DE59A0015AD55 /* Protocols */, 200562EF1E5DEAAB0015AD55 /* Helper Classes */, 200563101E5F9D550015AD55 /* Builders */, + 200563151E5FA1BF0015AD55 /* Extensions */, ); path = SimcoeExample; sourceTree = ""; @@ -411,10 +410,11 @@ 200563031E5F5F4A0015AD55 /* TrackerActionGenerator.swift in Sources */, 200562FB1E5F577D0015AD55 /* PurchaseTrackingAction.swift in Sources */, 20C3B1D31E5CED6C0095F185 /* TrackerTableViewController.swift in Sources */, - 2005630E1E5F8A9C0015AD55 /* UIStoryboardExtension.swift in Sources */, 200562EE1E5DEA780015AD55 /* AnalyticsEngine.swift in Sources */, + 200563181E5FA1BF0015AD55 /* UIStoryboardExtension.swift in Sources */, 200562F91E5F56D50015AD55 /* ErrorLoggingAction.swift in Sources */, 200562EC1E5DEA530015AD55 /* SimcoeAnalyticsEngine.swift in Sources */, + 200563191E5FA1BF0015AD55 /* UIViewControllerExtension.swift in Sources */, 200562F31E5F43B10015AD55 /* AddToCartLoggingAction.swift in Sources */, 200562E31E5DE5BA0015AD55 /* EventTrackerAction.swift in Sources */, 200563071E5F87030015AD55 /* AvailableTrackers.swift in Sources */, @@ -426,7 +426,6 @@ 200563091E5F87230015AD55 /* AnalyticsProviders.swift in Sources */, 200562F71E5F56030015AD55 /* CheckoutTrackingAction.swift in Sources */, 200563141E5F9E770015AD55 /* SimcoeExampleApplication.swift in Sources */, - 2005630C1E5F8A880015AD55 /* UIViewControllerExtension.swift in Sources */, 20C3B1D11E5CE7D70095F185 /* AnalyticsDisplayViewController.swift in Sources */, 200563121E5F9D630015AD55 /* AnalyticsDisplayBuilder.swift in Sources */, 200562F11E5DEAB20015AD55 /* AnalyticsTracker.swift in Sources */, diff --git a/SimcoeExample/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/SimcoeExample/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json index 118c98f..b8236c6 100644 --- a/SimcoeExample/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/SimcoeExample/SimcoeExample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", From 37754c191b4823094247aa71e65bdfc076cc1e27 Mon Sep 17 00:00:00 2001 From: Jonathan Samudio Date: Mon, 20 Mar 2017 16:08:57 -0400 Subject: [PATCH 10/11] Merged master into current branch. --- Podfile.lock | 8 +- README.md | 13 - Simcoe.podspec | 2 +- Simcoe/Adobe/Adobe.swift | 60 ++--- .../AnalyticsTracking.swift | 29 +- .../CartLogging.swift | 20 +- .../CheckoutTracking.swift | 12 +- .../ErrorLogging.swift | 20 +- .../EventTracking.swift | 4 +- .../LifetimeValueIncreasing.swift | 20 +- .../LocationTracking.swift | 18 +- .../PageViewTracking.swift | 17 +- .../PurchaseTracking.swift | 12 +- .../UserAttributeTracking.swift | 22 +- .../ViewDetailLogging.swift | 12 +- Simcoe/ConsoleOutput.swift | 8 +- Simcoe/EmptyProvider.swift | 127 ++++----- Simcoe/EnumerationListable.swift | 10 +- Simcoe/ErrorHandlingOption.swift | 12 +- Simcoe/Event.swift | 4 +- Simcoe/Output.swift | 4 +- Simcoe/OutputOptions.swift | 16 +- Simcoe/RemoteOutput.swift | 4 +- Simcoe/Simcoe.swift | 252 ++++++++---------- Simcoe/SimcoeProduct.swift | 14 +- Simcoe/SimcoeProductConvertible.swift | 2 +- Simcoe/Tracker.swift | 20 +- Simcoe/TrackingResult.swift | 10 +- Simcoe/mParticle/MPCommerceEvent+Simcoe.swift | 9 +- Simcoe/mParticle/MPCommerceEventKeys.swift | 18 +- Simcoe/mParticle/MPEvent+Simcoe.swift | 69 +++-- Simcoe/mParticle/MPEventGenerationError.swift | 6 +- Simcoe/mParticle/MPEventKeys.swift | 14 +- Simcoe/mParticle/MPProduct+Simcoe.swift | 4 +- Simcoe/mParticle/MPProductKeys.swift | 12 +- .../MPTransactionAttributes+Simcoe.swift | 6 +- .../MPTransactionAttributesKeys.swift | 12 +- Simcoe/mParticle/README.md | 6 +- Simcoe/mParticle/mParticle.swift | 202 +++++++------- SimcoeTests/Mocks/EventPropertiesFake.swift | 6 +- SimcoeTests/Mocks/ProductFake.swift | 4 +- SimcoeTests/Mocks/UserAttributesFake.swift | 2 +- SimcoeTests/SimcoeLoggingTests.swift | 2 +- SimcoeTests/mParticle/MPEventTests.swift | 17 +- 44 files changed, 508 insertions(+), 633 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index d1fe53a..58cadea 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -5,11 +5,11 @@ PODS: - mParticle-Apple-SDK (6.11.1): - mParticle-Apple-SDK/mParticle (= 6.11.1) - mParticle-Apple-SDK/mParticle (6.11.1) - - Simcoe/Adobe (0.5.1): + - Simcoe/Adobe (1.0.0): - AdobeMobileSDK (~> 4.13) - Simcoe/Core - - Simcoe/Core (0.5.1) - - Simcoe/mParticle (0.5.1): + - Simcoe/Core (1.0.0) + - Simcoe/mParticle (1.0.0): - mParticle-Apple-SDK (~> 6) - Simcoe/Core @@ -26,7 +26,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: AdobeMobileSDK: 52c3fbf43b5b054132393b1486ecbefca0ba01db mParticle-Apple-SDK: 8c7dfc195459870aa33be634f006342cb37d6a24 - Simcoe: 11fe674388e2f4c5b3f90090f165f5150b8aabb8 + Simcoe: 16d83bedf09ba7699471c61caf76aef29d0dc2e9 PODFILE CHECKSUM: 501664c76426d2cb9e5d6bac65a1b3138e7f43cb diff --git a/README.md b/README.md index 6e2b226..879d84b 100644 --- a/README.md +++ b/README.md @@ -110,19 +110,6 @@ While simply implementing this protocol is all you need for your object to be a So for your analytics provider to be able to handle page views in the Simcoe framework, your provider should implement the `PageViewTracking` protocol. This plug-and-play API allows you to define what you want your provider to handle at a very granular level. If your provider only needs to implement location tracking and nothing else, then you need only implement the `LocationTracking` protocol (as well as the `AnalyticsTracking` protocol, of course); all other protocols are optional. This allows you full customization as to how your objects respond to Simcoe. -Each provider type defined above maps directly to a Simcoe function that will call that method. These are, respectively: - -* `logAddToCart`, `logRemoveFromCart` -* `trackCheckoutEvent` -* `logError` -* `trackEvent` -* `increaseLifetimeValue` -* `trackLocation` -* `trackPageView` -* `trackPurchaseEvent` -* `setUserAttribute` -* `logViewDetail` - #### Additional Tracking Each analytics implementation is different, and Simcoe doesn't expect to be the be-all, end-all of analytics implementations. What if you need to track something that is not included in the base SDK? diff --git a/Simcoe.podspec b/Simcoe.podspec index f2d167e..9188e00 100644 --- a/Simcoe.podspec +++ b/Simcoe.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = "Simcoe" - s.version = "0.5.1" + s.version = "1.0.0" s.summary = "An analytics framework that provides a base layer of simple APIs for managing analytics frameworks." s.description = <<-DESC Simcoe is an analytics framework that aims to provide a simple, extensible API for managing and handling various analytics frameworks. It makes very few assumptions about your analytics implementations, allowing the implementer to customize it to their needs. diff --git a/Simcoe/Adobe/Adobe.swift b/Simcoe/Adobe/Adobe.swift index a37ae20..5e1125a 100644 --- a/Simcoe/Adobe/Adobe.swift +++ b/Simcoe/Adobe/Adobe.swift @@ -10,7 +10,7 @@ import AdobeMobileSDK import CoreLocation /// The adobe analytics provider. -open class Adobe { +public class Adobe { /// The name of the tracker. open let name = "Adobe Omniture" @@ -35,33 +35,32 @@ extension Adobe: EventTracking { /// - event: The event to track. /// - properties: The optional additional properties. /// - Returns: A tracking result. - public func track(event: String, withAdditionalProperties properties: Properties?) -> TrackingResult { + public func track(event: String, + withAdditionalProperties properties: Properties?) -> TrackingResult { ADBMobile.trackAction(event, data: properties) return .success } - + } // MARK: - LifetimeValueIncreasing extension Adobe: LifetimeValueIncreasing { - /** - Increases the lifetime value of the key by the specified amount. - - - parameter amount: The amount to increase that lifetime value for. - - parameter item: The optional item to extend. - - parameter properties: The optional additional properties. - - - returns: A tracking result. - */ + /// Increases the lifetime value of the key by the specified amount. + /// + /// - Parameters: + /// - amount: The amount to increase that lifetime value for. + /// - item: The optional item to extend. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. public func increaseLifetimeValue(byAmount amount: Double, forItem item: String?, withAdditionalProperties properties: Properties?) -> TrackingResult { - var data = properties ?? [String: AnyObject]() + var data = properties ?? Properties() if let item = item { - data[item] = "" as AnyObject + data[item] = "" } - ADBMobile.trackLifetimeValueIncrease(NSDecimalNumber(value: 1), data: data) + ADBMobile.trackLifetimeValueIncrease(NSDecimalNumber(value: amount), data: data) return .success } @@ -71,33 +70,30 @@ extension Adobe: LifetimeValueIncreasing { extension Adobe: LocationTracking { - /** - Tracks location. - - - parameter location: The location to track. - - parameter properties: The optional additional properties. - - - returns: A tracking result. - */ + /// Tracks location. + /// + /// - Parameters: + /// - location: The location to track. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. public func track(location: CLLocation, - withAdditionalProperties properties: Properties?) -> TrackingResult { + withAdditionalProperties properties: Properties?) -> TrackingResult { ADBMobile.trackLocation(location, data: properties) return .success } - + } // MARK: - PageViewTracking extension Adobe: PageViewTracking { - /** - Tracks the page view. - - - parameter pageView: The page view to track. - - - returns: A tracking result. - */ + /// Tracks the page view. + /// + /// - Parameters: + /// - pageView: The page view to track. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. public func track(pageView: String, withAdditionalProperties properties: Properties?) -> TrackingResult { ADBMobile.trackState(pageView, data: properties) return .success diff --git a/Simcoe/Analytics Tracking Protocols/AnalyticsTracking.swift b/Simcoe/Analytics Tracking Protocols/AnalyticsTracking.swift index deb59e0..b12f80b 100644 --- a/Simcoe/Analytics Tracking Protocols/AnalyticsTracking.swift +++ b/Simcoe/Analytics Tracking Protocols/AnalyticsTracking.swift @@ -6,10 +6,8 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - Default protocol for an object being trackable for analytics. All analytics items that wish to - be tracked must, at least, implement this protocol. - */ +/// Default protocol for an object being trackable for analytics. All analytics items that wish to +/// be tracked must, at least, implement this protocol. public protocol AnalyticsTracking { /// The name of the tracker. This is used for debugging purposes only, but should @@ -18,26 +16,23 @@ public protocol AnalyticsTracking { /// return "Adobe Omniture". var name: String { get } - /** - Starts tracking analytics. This is called on all providers passed to `Simcoe.run`. - Your analytics tracker should start tracking lifecycle data or setup anything else - that needs to run for the duration of the analytics lifecycle. - This is an optional value and is implemented by default in an extension to do nothing. - */ + /// Starts tracking analytics. This is called on all providers passed to `Simcoe.run`. + /// Your analytics tracker should start tracking lifecycle data or setup anything else + /// that needs to run for the duration of the analytics lifecycle. + /// + /// This is an optional value and is implemented by default in an extension to do nothing. func start() } public extension AnalyticsTracking { - /** - Starts tracking analytics. This is called on all providers passed to `Simcoe.run`. - Your analytics tracker should start tracking lifecycle data or setup anything else - that needs to run for the duration of the analytics lifecycle. - - This is an optional value and is implemented by default in an extension to do nothing. - */ + /// Starts tracking analytics. This is called on all providers passed to `Simcoe.run`. + /// Your analytics tracker should start tracking lifecycle data or setup anything else + /// that needs to run for the duration of the analytics lifecycle. + /// + /// This is an optional value and is implemented by default in an extension to do nothing. func start() { } diff --git a/Simcoe/Analytics Tracking Protocols/CartLogging.swift b/Simcoe/Analytics Tracking Protocols/CartLogging.swift index 8c81122..3bd72fc 100644 --- a/Simcoe/Analytics Tracking Protocols/CartLogging.swift +++ b/Simcoe/Analytics Tracking Protocols/CartLogging.swift @@ -6,25 +6,23 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - * Defines functionality for logging cart actions. - */ +/// Defines functionality for logging cart actions. public protocol CartLogging: AnalyticsTracking { /// Logs the addition of a product to the cart. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. + /// - Returns: A tracking result. func logAddToCart(_ product: T, eventProperties: Properties?) -> TrackingResult /// Logs the removal of a product from the cart. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. + /// - Returns: A tracking result. func logRemoveFromCart(_ product: T, eventProperties: Properties?) -> TrackingResult } diff --git a/Simcoe/Analytics Tracking Protocols/CheckoutTracking.swift b/Simcoe/Analytics Tracking Protocols/CheckoutTracking.swift index 323e59e..e8c8c3a 100644 --- a/Simcoe/Analytics Tracking Protocols/CheckoutTracking.swift +++ b/Simcoe/Analytics Tracking Protocols/CheckoutTracking.swift @@ -6,17 +6,15 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - * Defines functionality for tracking checkout actions. - */ +/// Defines functionality for tracking checkout actions. public protocol CheckoutTracking: AnalyticsTracking { /// Tracks a checkout event. /// - /// - parameter products: The products. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - products: The products. + /// - eventProperties: The event properties. + /// - Returns: A tracking result. func trackCheckoutEvent(_ products: [T], eventProperties: Properties?) -> TrackingResult } diff --git a/Simcoe/Analytics Tracking Protocols/ErrorLogging.swift b/Simcoe/Analytics Tracking Protocols/ErrorLogging.swift index b7a423d..dd28896 100644 --- a/Simcoe/Analytics Tracking Protocols/ErrorLogging.swift +++ b/Simcoe/Analytics Tracking Protocols/ErrorLogging.swift @@ -6,19 +6,15 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - Defines methods for logging errors to analytics. - */ +/// Defines methods for logging errors to analytics. public protocol ErrorLogging: AnalyticsTracking { - - /** - Logs the error with optional additional properties. - - - parameter error: The error to log. - - parameter properties: The optional additional properties. - - - returns: A tracking result. - */ + + /// Logs the error with optional additional properties. + /// + /// - Parameters: + /// - error: The error to log. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. func log(error: String, withAdditionalProperties properties: Properties?) -> TrackingResult } diff --git a/Simcoe/Analytics Tracking Protocols/EventTracking.swift b/Simcoe/Analytics Tracking Protocols/EventTracking.swift index d2f6adb..da8daba 100644 --- a/Simcoe/Analytics Tracking Protocols/EventTracking.swift +++ b/Simcoe/Analytics Tracking Protocols/EventTracking.swift @@ -6,9 +6,7 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - Defines methods for tracking analytics events. - */ +/// Defines methods for tracking analytics events. public protocol EventTracking: AnalyticsTracking { /// Tracks the given event with optional additional properties. diff --git a/Simcoe/Analytics Tracking Protocols/LifetimeValueIncreasing.swift b/Simcoe/Analytics Tracking Protocols/LifetimeValueIncreasing.swift index 6f259b3..8e21b48 100644 --- a/Simcoe/Analytics Tracking Protocols/LifetimeValueIncreasing.swift +++ b/Simcoe/Analytics Tracking Protocols/LifetimeValueIncreasing.swift @@ -6,20 +6,16 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - Defines methods for increasing a lifetime value of an analytics key. - */ +/// Defines methods for increasing a lifetime value of an analytics key. public protocol LifetimeValueIncreasing: AnalyticsTracking { - /** - Increases the lifetime value of the key by the specified amount. - - - parameter amount: The amount to increase that lifetime value for. - - parameter item: The optional item to extend. - - parameter properties: The optional additional properties. - - - returns: A tracking result. - */ + /// Increases the lifetime value of the key by the specified amount. + /// + /// - Parameters: + /// - amount: The amount to increase that lifetime value for. + /// - item: The optional item to extend. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. func increaseLifetimeValue(byAmount amount: Double, forItem item: String?, withAdditionalProperties properties: Properties?) -> TrackingResult diff --git a/Simcoe/Analytics Tracking Protocols/LocationTracking.swift b/Simcoe/Analytics Tracking Protocols/LocationTracking.swift index 05c74e4..dca1b6c 100644 --- a/Simcoe/Analytics Tracking Protocols/LocationTracking.swift +++ b/Simcoe/Analytics Tracking Protocols/LocationTracking.swift @@ -8,19 +8,15 @@ import CoreLocation -/** - Defines methods for tracking a user's location data. - */ +/// Defines methods for tracking a user's location data. public protocol LocationTracking: AnalyticsTracking { - /** - Tracks location. - - - parameter location: The location to track. - - parameter properties: The optional additional properties. - - - returns: A tracking result. - */ + /// Tracks location. + /// + /// - Parameters: + /// - location: The location to track. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. func track(location: CLLocation, withAdditionalProperties properties: Properties?) -> TrackingResult } diff --git a/Simcoe/Analytics Tracking Protocols/PageViewTracking.swift b/Simcoe/Analytics Tracking Protocols/PageViewTracking.swift index 032c27f..b87204a 100644 --- a/Simcoe/Analytics Tracking Protocols/PageViewTracking.swift +++ b/Simcoe/Analytics Tracking Protocols/PageViewTracking.swift @@ -6,18 +6,15 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - Defines functionality for tracking page views. - */ +/// Defines functionality for tracking page views. public protocol PageViewTracking: AnalyticsTracking { - /** - Tracks the page view. - - - parameter pageView: The page view to track. - - - returns: A tracking result. - */ + /// Tracks the page view. + /// + /// - Parameters: + /// - pageView: The page view to track. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. func track(pageView: String, withAdditionalProperties properties: Properties?) -> TrackingResult } diff --git a/Simcoe/Analytics Tracking Protocols/PurchaseTracking.swift b/Simcoe/Analytics Tracking Protocols/PurchaseTracking.swift index 8c5378a..22b87cb 100644 --- a/Simcoe/Analytics Tracking Protocols/PurchaseTracking.swift +++ b/Simcoe/Analytics Tracking Protocols/PurchaseTracking.swift @@ -6,17 +6,15 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - * Defines functionality for tracking purchase actions. - */ +/// Defines functionality for tracking purchase actions. public protocol PurchaseTracking: AnalyticsTracking { /// Tracks a purchase event. /// - /// - parameter products: The products. - /// - parameter eventProperties: The event properties - /// - /// - returns: A tracking result. + /// - Parameters: + /// - products: The products. + /// - eventProperties: The event properties + /// - Returns: A tracking result. func trackPurchaseEvent(_ products: [T], eventProperties: Properties?) -> TrackingResult } diff --git a/Simcoe/Analytics Tracking Protocols/UserAttributeTracking.swift b/Simcoe/Analytics Tracking Protocols/UserAttributeTracking.swift index 15811b5..60d5d07 100644 --- a/Simcoe/Analytics Tracking Protocols/UserAttributeTracking.swift +++ b/Simcoe/Analytics Tracking Protocols/UserAttributeTracking.swift @@ -6,19 +6,15 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - Defines functionality for logging errors to analytics. - */ +/// Defines functionality for logging errors to analytics. public protocol UserAttributeTracking: AnalyticsTracking { - - /** - Sets the User Attribute. - - - parameter key: The attribute key to log. - - parameter value: The attribute value to log. - - - returns: A tracking result. - */ - func setUserAttribute(_ key: String, value: AnyObject) -> TrackingResult + + /// Sets the User Attribute. + /// + /// - Parameters: + /// - key: The attribute key to log. + /// - value: The attribute value to log. + /// - Returns: A tracking result. + func setUserAttribute(_ key: String, value: Any) -> TrackingResult } diff --git a/Simcoe/Analytics Tracking Protocols/ViewDetailLogging.swift b/Simcoe/Analytics Tracking Protocols/ViewDetailLogging.swift index 47b9e7a..1bb2545 100644 --- a/Simcoe/Analytics Tracking Protocols/ViewDetailLogging.swift +++ b/Simcoe/Analytics Tracking Protocols/ViewDetailLogging.swift @@ -6,17 +6,15 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - * Defines functionality for logging view detail actions. - */ +/// Defines functionality for logging view detail actions. public protocol ViewDetailLogging: AnalyticsTracking { /// Logs the action of viewing a product's details. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. + /// - Returns: A tracking result. func logViewDetail(_ product: T, eventProperties: Properties?) -> TrackingResult } diff --git a/Simcoe/ConsoleOutput.swift b/Simcoe/ConsoleOutput.swift index 5bcd2d0..76cd081 100644 --- a/Simcoe/ConsoleOutput.swift +++ b/Simcoe/ConsoleOutput.swift @@ -9,11 +9,9 @@ /// The default console output. internal final class ConsoleOutput: Output { - /** - Prints a message to the standard output. - - - parameter message: The message to print. - */ + /// Prints a message to the standard output. + /// + /// - Parameter message: The message to print. func print(_ message: String) { Swift.print(message) } diff --git a/Simcoe/EmptyProvider.swift b/Simcoe/EmptyProvider.swift index 5f7d69b..6de03d4 100644 --- a/Simcoe/EmptyProvider.swift +++ b/Simcoe/EmptyProvider.swift @@ -22,20 +22,20 @@ extension EmptyProvider: CartLogging { /// Logs the addition of a product to the cart. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. + /// - Returns: A tracking result. func logAddToCart(_ product: T, eventProperties: Properties?) -> TrackingResult { return .success } /// Logs the removal of a product from the cart. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. + /// - Returns: A tracking result. func logRemoveFromCart(_ product: T, eventProperties: Properties?) -> TrackingResult { return .success } @@ -47,10 +47,10 @@ extension EmptyProvider: CheckoutTracking { /// Tracks a checkout event. /// - /// - parameter products: The products. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - products: The products. + /// - eventProperties: The event properties. + /// - Returns: A tracking result. func trackCheckoutEvent(_ products: [T], eventProperties: Properties?) -> TrackingResult { return .success } @@ -61,14 +61,12 @@ extension EmptyProvider: CheckoutTracking { extension EmptyProvider: ErrorLogging { - /** - Logs the error with optional additional properties. - - - parameter error: The error to log. - - parameter properties: The optional additional properties. - - - returns: A tracking result. - */ + /// Logs the error with optional additional properties. + /// + /// - Parameters: + /// - error: The error to log. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. func log(error: String, withAdditionalProperties properties: Properties?) -> TrackingResult { return .success } @@ -79,14 +77,12 @@ extension EmptyProvider: ErrorLogging { extension EmptyProvider: EventTracking { - /** - Tracks the given event with optional additional properties. - - - parameter event: The event to tack. - - parameter properties: The optional additional properties. - - - returns: A tracking result. - */ + /// Tracks the given event with optional additional properties. + /// + /// - Parameters: + /// - event: The event to track. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. func track(event: String, withAdditionalProperties properties: Properties?) -> TrackingResult { return .success } @@ -97,15 +93,13 @@ extension EmptyProvider: EventTracking { extension EmptyProvider: LifetimeValueIncreasing { - /** - Increases the lifetime value of the key by the specified amount. - - - parameter amount: The amount to increase that lifetime value for. - - parameter item: The optional item to extend. - - parameter properties: The optional additional properties. - - - returns: A tracking result. - */ + /// Increases the lifetime value of the key by the specified amount. + /// + /// - Parameters: + /// - amount: The amount to increase that lifetime value for. + /// - item: The optional item to extend. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. func increaseLifetimeValue(byAmount amount: Double, forItem item: String?, withAdditionalProperties properties: Properties?) -> TrackingResult { return .success } @@ -116,14 +110,12 @@ extension EmptyProvider: LifetimeValueIncreasing { extension EmptyProvider: LocationTracking { - /** - Tracks location. - - - parameter location: The location to track. - - parameter properties: The optional additional properties. - - - returns: A tracking result. - */ + /// Tracks location. + /// + /// - Parameters: + /// - location: The location to track. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. func track(location: CLLocation, withAdditionalProperties properties: Properties?) -> TrackingResult { return .success } @@ -134,13 +126,12 @@ extension EmptyProvider: LocationTracking { extension EmptyProvider: PageViewTracking { - /** - Tracks the page view. - - - parameter pageView: The page view to track. - - - returns: A tracking result. - */ + /// Tracks the page view. + /// + /// - Parameters: + /// - pageView: The page view to track. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. func track(pageView: String, withAdditionalProperties properties: Properties?) -> TrackingResult { return .success } @@ -153,10 +144,10 @@ extension EmptyProvider: PurchaseTracking { /// Tracks a purchase event. /// - /// - parameter products: The products. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - products: The products. + /// - eventProperties: The event properties + /// - Returns: A tracking result. func trackPurchaseEvent(_ products: [T], eventProperties: Properties?) -> TrackingResult { return .success } @@ -167,15 +158,13 @@ extension EmptyProvider: PurchaseTracking { extension EmptyProvider: UserAttributeTracking { - /** - Sets the User Attribute. - - - parameter key: The attribute key to log. - - parameter value: The attribute value to log. - - - returns: A tracking result. - */ - func setUserAttribute(_ key: String, value: AnyObject) -> TrackingResult { + /// Sets the User Attribute. + /// + /// - Parameters: + /// - key: The attribute key to log. + /// - value: The attribute value to log. + /// - Returns: A tracking result. + func setUserAttribute(_ key: String, value: Any) -> TrackingResult { return .success } @@ -187,10 +176,10 @@ extension EmptyProvider: ViewDetailLogging { /// Logs the action of viewing a product's details. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. + /// - Returns: A tracking result. func logViewDetail(_ product: T, eventProperties: Properties?) -> TrackingResult { return .success } diff --git a/Simcoe/EnumerationListable.swift b/Simcoe/EnumerationListable.swift index 16c7e88..4dc0440 100644 --- a/Simcoe/EnumerationListable.swift +++ b/Simcoe/EnumerationListable.swift @@ -17,9 +17,8 @@ extension EnumerationListable where Self: RawRepresentable { /// The unfound keys in the provided Properties. /// - /// - parameter properties: The properties. - /// - /// - returns: The unfound keys. + /// - Parameter properties: The properties. + /// - Returns: The unfound keys. fileprivate static func unfoundKeys(_ properties: Properties) -> [String] { let allKeyRawValues: [String] = Self.allKeys.flatMap { $0.rawValue as? String } let allKeyRawValuesSet = Set(allKeyRawValues) @@ -32,9 +31,8 @@ extension EnumerationListable where Self: RawRepresentable { /// The remaining properties. /// - /// - parameter properties: The properties. - /// - /// - returns: The remaining properties. + /// - Parameter properties: The properties. + /// - Returns: The remaining properties. static func remaining(properties: Properties) -> Properties { let unfoundKeys = Self.unfoundKeys(properties) var additionalProperties = Properties() diff --git a/Simcoe/ErrorHandlingOption.swift b/Simcoe/ErrorHandlingOption.swift index 0faf8a0..769ae4f 100644 --- a/Simcoe/ErrorHandlingOption.swift +++ b/Simcoe/ErrorHandlingOption.swift @@ -6,13 +6,11 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - The various options for handling errors. - - - Suppress: Suppresses errors; basically any error is ignored. - - Default: Default error handling; errors are logged to the output log. - - Strict: Strict error handling; any errors encountered will trigger a fatalError(). - */ +/// The various options for handling errors. +/// +/// - suppress: Suppresses errors; basically any error is ignored. +/// - `default`: Default error handling; errors are logged to the output log. +/// - strict: Strict error handling; any errors encountered will trigger a fatalError(). public enum ErrorHandlingOption { case suppress diff --git a/Simcoe/Event.swift b/Simcoe/Event.swift index add4865..ce34d4e 100644 --- a/Simcoe/Event.swift +++ b/Simcoe/Event.swift @@ -6,9 +6,7 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - A Simcoe Event. - */ +/// A Simcoe Event. internal struct Event { /// The write actions that occurred in this event. diff --git a/Simcoe/Output.swift b/Simcoe/Output.swift index dffce56..aea5700 100644 --- a/Simcoe/Output.swift +++ b/Simcoe/Output.swift @@ -6,9 +6,7 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - Defines an object as an output source. - */ +/// Defines an object as an output source. internal protocol Output { /// Prints a message to the output source. diff --git a/Simcoe/OutputOptions.swift b/Simcoe/OutputOptions.swift index a7bebdb..611f95f 100644 --- a/Simcoe/OutputOptions.swift +++ b/Simcoe/OutputOptions.swift @@ -6,15 +6,13 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - The various options for how to output records to the standard output. - - - None: No output; disables records displaying in the output. - - Simple: Only outputs one item per event, no matter how many providers were recorded. - - Verbose: Outputs one line for each provider per event, specifying which provider was recorded. - This is the best option if you are using many providers and want to verify data is being output - to each one. - */ +/// The various options for how to output records to the standard output. +/// +/// - none: No output; disables records displaying in the output. +/// - simple: Only outputs one item per event, no matter how many providers were recorded. +/// - verbose: Outputs one line for each provider per event, specifying which provider was recorded. +/// This is the best option if you are using many providers and want to verify data is being output +/// to each one. public enum OutputOptions { case none diff --git a/Simcoe/RemoteOutput.swift b/Simcoe/RemoteOutput.swift index c5d5606..c577bfc 100644 --- a/Simcoe/RemoteOutput.swift +++ b/Simcoe/RemoteOutput.swift @@ -8,9 +8,7 @@ import Foundation -/** - * A remote output source. - */ +/// A remote output source. internal struct RemoteOutput: Output { /// The token. diff --git a/Simcoe/Simcoe.swift b/Simcoe/Simcoe.swift index 496484a..06adf4d 100644 --- a/Simcoe/Simcoe.swift +++ b/Simcoe/Simcoe.swift @@ -33,33 +33,24 @@ public final class Simcoe { } } - /** - Initializes a new instance using the specified tracker. - - - parameter tracker: The tracker to use. - - - returns: An instance of Simcoe. - */ + /// Initializes a new instance using the specified tracker. + /// + /// - Parameter tracker: The tracker to use. init(tracker: Tracker) { self.tracker = tracker } - /** - Retrieves the provider based on its kind from the current list of providers. - - - parameter _: The kind of provider to retrieve. - - - returns: The provider if it is exists; otherwise nil. - */ + /// Retrieves the provider based on its kind from the current list of providers. + /// + /// - Parameter _: The kind of provider to retrieve. + /// - Returns: The provider if it is exists; otherwise nil. public static func provider(ofKind _: T) -> T? { return engine.providers.filter({ provider in return provider is T }).first as? T } - /** - Begins running using the input providers. - - - parameter providers: The providers to use for analytics tracking. - */ + /// Begins running using the input providers. + /// + /// - Parameter providers: The providers to use for analytics tracking. public static func run(with providers: [AnalyticsTracking] = [AnalyticsTracking]()) { var analyticsProviders = providers if analyticsProviders.isEmpty { @@ -69,13 +60,12 @@ public final class Simcoe { engine.providers = analyticsProviders } - /** - Writes the event. - - - parameter providers: The list of provides. - - parameter description: The event description. - - parameter action: The action description. - */ + /// Writes the event. + /// + /// - Parameters: + /// - providers: The list of providers. + /// - description: The event description. + /// - action: The action description. public func write(toProviders providers: [T], description: String, action: (T) -> TrackingResult) { let writeEvents = providers.map { provider -> WriteEvent in let result = action(provider) @@ -96,20 +86,18 @@ public final class Simcoe { /// Logs the addition of a product to the cart. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. public static func logAddToCart(_ product: T, eventProperties: Properties?) { engine.logAddToCart(product, eventProperties: eventProperties) } /// Logs the addition of a product to the cart. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. func logAddToCart(_ product: T, eventProperties: Properties?) { let providers: [CartLogging] = findProviders() let simcoeProduct = product.toSimcoeProduct() @@ -127,20 +115,18 @@ public final class Simcoe { /// Logs the removal of a product from the cart. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. public static func logRemoveFromCart(_ product: T, eventProperties: Properties?) { engine.logRemoveFromCart(product, eventProperties: eventProperties) } /// Logs the removal of a product from the cart. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. func logRemoveFromCart(_ product: T, eventProperties: Properties?) { let providers: [CartLogging] = findProviders() let simcoeProduct = product.toSimcoeProduct() @@ -160,20 +146,18 @@ public final class Simcoe { /// Tracks a checkout event. /// - /// - parameter products: The products. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - products: The products. + /// - eventProperties: The event properties. public static func trackCheckoutEvent(_ products: [T], eventProperties: Properties?) { engine.trackCheckoutEvent(products, eventProperties: eventProperties) } /// Tracks a checkout event. /// - /// - parameter products: The products. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - products: The products. + /// - eventProperties: The event properties. func trackCheckoutEvent(_ products: [T], eventProperties: Properties?) { let providers: [CheckoutTracking] = findProviders() let propertiesString = eventProperties != nil ? "=> \(eventProperties!.description)" : "" @@ -191,22 +175,20 @@ public final class Simcoe { // MARK: - ErrorLogging - /** - Logs the error with optional additional properties. - - - parameter error: The error to log. - - parameter properties: The optional additional properties. - */ + /// Logs the error with optional additional properties. + /// + /// - Parameters: + /// - error: The error to log. + /// - properties: The optional additional properties. public static func log(error: String, withAdditionalProperties properties: Properties? = nil) { engine.log(error: error, withAdditionalProperties: properties) } - /** - Logs the error with optional additional properties. - - - parameter error: The error to log. - - parameter properties: The optional additional properties. - */ + /// Logs the error with optional additional properties. + /// + /// - Parameters: + /// - error: The error to log. + /// - properties: The optional additional properties. func log(error: String, withAdditionalProperties properties: Properties? = nil) { let providers: [ErrorLogging] = findProviders() @@ -218,22 +200,20 @@ public final class Simcoe { // MARK: - EventTracking - /** - Tracks an analytics action or event. - - - parameter event: The event that occurred. - - parameter properties: The optional additional properties. - */ + /// Tracks an analytics action or event. + /// + /// - Parameters: + /// - event: The event that occurred. + /// - properties: The optional additional properties. public static func track(event: String, withAdditionalProperties properties: Properties? = nil) { engine.track(event: event, withAdditionalProperties: properties) } - /** - Tracks the event. - - - parameter event: The event to track. - - parameter properties: The optional additional properties. - */ + /// Tracks the event. + /// + /// - Parameters: + /// - event: The event to track. + /// - properties: The optional additional properties. func track(event: String, withAdditionalProperties properties: Properties? = nil) { let providers: [EventTracking] = findProviders() @@ -245,25 +225,23 @@ public final class Simcoe { // MARK: - LifetimeValueIncreasing - /** - Tracks the lifetime value increase. - - - parameter amount: The amount to increase that lifetime value for. - - parameter item: The optional item to extend. - - parameter properties: The optional additional properties. - */ + /// Tracks the lifetime value increase. + /// + /// - Parameters: + /// - amount: The amount to increase that lifetime value for. + /// - item: The optional item to extend. + /// - properties: The optional additional properties. public static func trackLifetimeIncrease(byAmount amount: Double = 1, forItem item: String? = nil, withAdditionalProperties properties: Properties? = nil) { engine.trackLifetimeIncrease(byAmount: amount, forItem: item, withAdditionalProperties: properties) } - /** - Tracks the lifetime value increase. - - - parameter amount: The amount to increase that lifetime value for. - - parameter item: The optional item to extend. - - parameter properties: The optional additional properties. - */ + /// Tracks the lifetime value increase. + /// + /// - Parameters: + /// - amount: The amount to increase that lifetime value for. + /// - item: The optional item to extend. + /// - properties: The optional additional properties. func trackLifetimeIncrease(byAmount amount: Double = 1, forItem item: String? = nil, withAdditionalProperties properties: Properties? = nil) { let providers: [LifetimeValueIncreasing] = findProviders() @@ -276,22 +254,20 @@ public final class Simcoe { // MARK: - LocationTracking - /** - Tracks a user's location. - - - parameter location: The user's location. - - parameter properties: The optional additional properties. - */ + /// Tracks location. + /// + /// - Parameters: + /// - location: The location to track. + /// - properties: The optional additional properties. public static func track(location: CLLocation, withAdditionalProperties properties: Properties?) { engine.track(location: location, withAdditionalProperties: properties) } - /** - Tracks a user's location. - - - parameter location: The user's location. - - parameter properties: The optional additional properties. - */ + /// Tracks location. + /// + /// - Parameters: + /// - location: The location to track. + /// - properties: The optional additional properties. func track(location: CLLocation, withAdditionalProperties properties: Properties?) { let providers: [LocationTracking] = findProviders() @@ -302,22 +278,20 @@ public final class Simcoe { // MARK: - PageViewTracking - /** - Tracks a page view. - - - parameter pageView: The page view event. - - parameter properties: The optional additional properties. - */ + /// Tracks the page view. + /// + /// - Parameters: + /// - pageView: The page view to track. + /// - properties: The optional additional properties. public static func track(pageView: String, withAdditionalProperties properties: Properties? = nil) { engine.track(pageView: pageView, withAdditionalProperties: properties) } - /** - Tracks the page view. - - - parameter pageView: The page view to track. - - parameter properties: The optional additional properties. - */ + /// Tracks the page view. + /// + /// - Parameters: + /// - pageView: The page view to track. + /// - properties: The optional additional properties. func track(pageView: String, withAdditionalProperties properties: Properties? = nil) { let providers: [PageViewTracking] = findProviders() @@ -330,20 +304,18 @@ public final class Simcoe { /// Tracks a purchase event. /// - /// - parameter products: The products. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - products: The products. + /// - eventProperties: The event properties public static func trackPurchaseEvent(_ products: [T], eventProperties: Properties?) { engine.trackPurchaseEvent(products, eventProperties: eventProperties) } /// Tracks a purchase event. /// - /// - parameter products: The products. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - products: The products. + /// - eventProperties: The event properties func trackPurchaseEvent(_ products: [T], eventProperties: Properties?) { let providers: [PurchaseTracking] = findProviders() let propertiesString = eventProperties != nil ? "=> \(eventProperties!.description)" : "" @@ -361,23 +333,21 @@ public final class Simcoe { // MARK: - UserAttributeTracking - /** - Sets the User Attribute. - - - parameter key: The key of the user attribute - - parameter value: the value of the user attribute - */ - public static func setUserAttribute(_ key: String, value: AnyObject) { + /// Sets the User Attribute. + /// + /// - Parameters: + /// - key: The attribute key to log. + /// - value: The attribute value to log. + public static func setUserAttribute(_ key: String, value: Any) { engine.setUserAttribute(key, value: value) } - /** - Sets the User Attribute. - - - parameter key: The key of the user attribute - - parameter value: the value of the user attribute - */ - func setUserAttribute(_ key: String, value: AnyObject) { + /// Sets the User Attribute. + /// + /// - Parameters: + /// - key: The attribute key to log. + /// - value: The attribute value to log. + func setUserAttribute(_ key: String, value: Any) { let providers: [UserAttributeTracking] = findProviders() write(toProviders: providers, description: "Setting user attribute with key: \(key) value:\(value)") { attributeSetter in @@ -389,20 +359,18 @@ public final class Simcoe { /// Logs the action of viewing a product's details. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. public static func logViewDetail(_ product: T, eventProperties: Properties?) { engine.logViewDetail(product, eventProperties: eventProperties) } /// Logs the action of viewing a product's details. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. func logViewDetail(_ product: T, eventProperties: Properties?) { let providers: [ViewDetailLogging] = findProviders() let simcoeProduct = product.toSimcoeProduct() diff --git a/Simcoe/SimcoeProduct.swift b/Simcoe/SimcoeProduct.swift index 6014286..c5a2db2 100644 --- a/Simcoe/SimcoeProduct.swift +++ b/Simcoe/SimcoeProduct.swift @@ -8,6 +8,7 @@ /// The product. public struct SimcoeProduct { + /// The product name. public let productName: String @@ -25,13 +26,12 @@ public struct SimcoeProduct { /// The default initializer. /// - /// - parameter productName: The product name. - /// - parameter productId: The product Id. - /// - parameter quantity: The quantity. - /// - parameter price: The price. - /// - parameter properties: The properties. - /// - /// - returns: A Product instance. + /// - Parameters: + /// - productName: The product name. + /// - productId: The product Id. + /// - quantity: The quantity. + /// - price: The price. + /// - properties: The properties. public init(productName: String, productId: String, quantity: Int, diff --git a/Simcoe/SimcoeProductConvertible.swift b/Simcoe/SimcoeProductConvertible.swift index 0292f84..8e007e1 100644 --- a/Simcoe/SimcoeProductConvertible.swift +++ b/Simcoe/SimcoeProductConvertible.swift @@ -11,7 +11,7 @@ public protocol SimcoeProductConvertible { /// Converts a product to a Simcoe Product. /// - /// - returns: A SimcoeProduct + /// - Returns: A SimcoeProduct func toSimcoeProduct() -> SimcoeProduct } diff --git a/Simcoe/Tracker.swift b/Simcoe/Tracker.swift index a7c4b5d..5a410ae 100644 --- a/Simcoe/Tracker.swift +++ b/Simcoe/Tracker.swift @@ -6,7 +6,7 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/// A recorder for SimcoeEvents +/// A recorder for SimcoeEvents. public final class Tracker { /// The output option for the recorder. Defaults to .Verbose. @@ -20,21 +20,17 @@ public final class Tracker { fileprivate let outputSources: [Output] - /** - Initializes a new instance using the specified source as its output. By default, this is the - standard output console. - - - parameter outputSource: The source to use for general output. - */ + /// Initializes a new instance using the specified source as its output. By default, this is the + /// standard output console. + /// + /// - Parameter outputSources: The source to use for general output. init(outputSources: [Output] = [ConsoleOutput(), RemoteOutput(token: Simcoe.session)]) { self.outputSources = outputSources } - /** - Records the event. - - - parameter event: The event to record. - */ + /// Records the event. + /// + /// - Parameter event: The event to record. func track(event: Event) { events.append(event) parseEvent(event) diff --git a/Simcoe/TrackingResult.swift b/Simcoe/TrackingResult.swift index da0c938..2f1d6fb 100644 --- a/Simcoe/TrackingResult.swift +++ b/Simcoe/TrackingResult.swift @@ -6,12 +6,10 @@ // Copyright © 2016 Prolific Interactive. All rights reserved. // -/** - A result of an analytics tracking operation. - - - Success: The operation was successfully logged to the analytics provider. - - Error: An error occurred while logging to the analytics provider; the message value indicates a human-readable description of why that error occurred. - */ +/// A result of an analytics tracking operation. +/// +/// - success: The operation was successfully logged to the analytics provider. +/// - error: An error occurred while logging to the analytics provider; the message value indicates a human-readable description of why that error occurred. public enum TrackingResult { case success diff --git a/Simcoe/mParticle/MPCommerceEvent+Simcoe.swift b/Simcoe/mParticle/MPCommerceEvent+Simcoe.swift index 593435b..0b2b1d4 100644 --- a/Simcoe/mParticle/MPCommerceEvent+Simcoe.swift +++ b/Simcoe/mParticle/MPCommerceEvent+Simcoe.swift @@ -12,11 +12,10 @@ extension MPCommerceEvent { /// A convenience initializer for MPCommerceEvent. /// - /// - parameter eventType: The event type. - /// - parameter products: The products. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A MPCommerceEvent instance. + /// - Parameters: + /// - eventType: The event type. + /// - products: The products. + /// - eventProperties: The event properties. internal convenience init(eventType: MPCommerceEventAction, products: [MPProduct], eventProperties: Properties?) { diff --git a/Simcoe/mParticle/MPCommerceEventKeys.swift b/Simcoe/mParticle/MPCommerceEventKeys.swift index 50bcc5d..e2358ca 100644 --- a/Simcoe/mParticle/MPCommerceEventKeys.swift +++ b/Simcoe/mParticle/MPCommerceEventKeys.swift @@ -8,15 +8,15 @@ /// The MPCommerceEvent keys available to use with eventProperties. /// -/// - CheckoutOptions: The checkout options. -/// - CheckoutStep: The checkout step. -/// - Currency: The currency. -/// - NonInteractive: The non interactive flag. -/// - PromotionContainer: The promotion container. -/// - ProductListName: The product list name. -/// - ProductListSource: The product list source. -/// - ScreenName: The screen name. -/// - TransactionAttributes: The transactions attributes. +/// - checkoutOptions: The checkout options. +/// - checkoutStep: The checkout step. +/// - currency: The currency. +/// - nonInteractive: The non interactive flag. +/// - promotionContainer: The promotion container. +/// - productListName: The product list name. +/// - productListSource: The product list source. +/// - screenName: The screen name. +/// - transactionAttributes: The transactions attributes. public enum MPCommerceEventKeys: String, EnumerationListable { case checkoutOptions = "checkoutOptions" diff --git a/Simcoe/mParticle/MPEvent+Simcoe.swift b/Simcoe/mParticle/MPEvent+Simcoe.swift index 1fc32b6..cce0993 100644 --- a/Simcoe/mParticle/MPEvent+Simcoe.swift +++ b/Simcoe/mParticle/MPEvent+Simcoe.swift @@ -10,55 +10,53 @@ import mParticle_Apple_SDK extension MPEvent { - /** - Creates a dictionary used to generate an MPEvent object. All of the input parameters map to - properties on the MPEvent object. Not setting any of the properties will not initialize those respective - properties of the MPEvent object. - - The `info` parameter will generate additional key / value pairs into the root level of the dictionary. - - It is safe to additionally add key / values into the root of the dictionary; any key / values passed in that - are not recognized will be set in the info dictionary of the generated MPEvent object. - - - parameter type: The event type. Required. - - parameter name: The event name. Required. - - parameter category: The category of the event. Optional. - - parameter duration: The duration of the event. Optional. - - parameter startTime: The start time of the event. Optional. - - parameter endTime: The end time of the event. Optional. - - parameter customFlags: The custom flags for the event. Optional. - - parameter info: Additional key / value pairs to place into the root level of the dictionary. These will - map to the `info` dictionary of the generated MPEvent object. - - - returns: A dictionary containing the information for generating an MPEvent. - */ + /// Creates a dictionary used to generate an MPEvent object. All of the input parameters map to + /// properties on the MPEvent object. Not setting any of the properties will not initialize those respective + /// properties of the MPEvent object. + /// + /// The `info` parameter will generate additional key / value pairs into the root level of the dictionary. + /// + /// It is safe to additionally add key / values into the root of the dictionary; any key / values passed in that + /// are not recognized will be set in the info dictionary of the generated MPEvent object. + /// + /// - Parameters: + /// - type: The event type. Required. + /// - name: The event name. Required. + /// - category: The category of the event. Optional. + /// - duration: The duration of the event. Optional. + /// - startTime: The start time of the event. Optional. + /// - endTime: The end time of the event. Optional. + /// - customFlags: The custom flags for the event. Optional. + /// - info: Additional key / value pairs to place into the root level of the dictionary. These will + /// map to the `info` dictionary of the generated MPEvent object. + /// - Returns: A dictionary containing the information for generating an MPEvent. public static func eventData(type: MPEventType, name: String, category: String? = nil, duration: Float? = nil, startTime: Date? = nil, endTime: Date? = nil, customFlags: [String: [String]]? = nil, info: Properties? = nil) -> Properties { - var properties: Properties = [MPEventKeys.eventType.rawValue: type.rawValue as AnyObject] + var properties = Properties() - properties[MPEventKeys.eventType.rawValue] = type.rawValue as AnyObject - properties[MPEventKeys.name.rawValue] = name as AnyObject + properties[MPEventKeys.eventType.rawValue] = type.rawValue + properties[MPEventKeys.name.rawValue] = name if let category = category { - properties[MPEventKeys.category.rawValue] = category as AnyObject + properties[MPEventKeys.category.rawValue] = category } if let duration = duration { - properties[MPEventKeys.duration.rawValue] = duration as AnyObject + properties[MPEventKeys.duration.rawValue] = duration } if let startTime = startTime { - properties[MPEventKeys.startTime.rawValue] = startTime as AnyObject + properties[MPEventKeys.startTime.rawValue] = startTime } if let endTime = endTime { - properties[MPEventKeys.endTime.rawValue] = endTime as AnyObject + properties[MPEventKeys.endTime.rawValue] = endTime } if let customFlags = customFlags { - properties[MPEventKeys.customFlags.rawValue] = customFlags as AnyObject + properties[MPEventKeys.customFlags.rawValue] = customFlags } if let info = info { @@ -70,14 +68,11 @@ extension MPEvent { return properties } - /// Generates a MPEvent object based on the passed in Properties. /// - /// - parameter data: The properties. - /// - /// - throws: MPEventGenerationError - /// - /// - returns: A MPEvent. + /// - Parameter data: The properties. + /// - Returns: A MPEvent. + /// - Throws: MPEventGenerationError internal static func toEvent(usingData data: Properties) throws -> MPEvent { guard let name = data[MPEventKeys.name.rawValue] as? String else { throw MPEventGenerationError.nameMissing @@ -97,7 +92,7 @@ extension MPEvent { } if let duration = data[MPEventKeys.duration.rawValue] as? Float { - event.duration = duration as NSNumber + event.duration = NSNumber(value: duration) } if let startTime = data[MPEventKeys.startTime.rawValue] as? Date { diff --git a/Simcoe/mParticle/MPEventGenerationError.swift b/Simcoe/mParticle/MPEventGenerationError.swift index 0e23dc2..1e432b5 100644 --- a/Simcoe/mParticle/MPEventGenerationError.swift +++ b/Simcoe/mParticle/MPEventGenerationError.swift @@ -8,9 +8,9 @@ /// The MPEvent generation error types. /// -/// - NameMissing: The name missing error. -/// - TypeMissing: The type missing error. -/// - EventInitFailed: The event init failed error. +/// - nameMissing: The name missing error. +/// - typeMissing: The type missing error. +/// - eventInitFailed: The event init failed error. internal enum MPEventGenerationError: Error { case nameMissing diff --git a/Simcoe/mParticle/MPEventKeys.swift b/Simcoe/mParticle/MPEventKeys.swift index 2039edc..bafafe0 100644 --- a/Simcoe/mParticle/MPEventKeys.swift +++ b/Simcoe/mParticle/MPEventKeys.swift @@ -8,13 +8,13 @@ /// The MPEvent keys. /// -/// - EventType: The event type. -/// - Category: The category. -/// - Duration: The duration. -/// - StartTime: The start time. -/// - EndTime: The end time. -/// - Name: The name. -/// - CustomFlags: The custom flags. +/// - eventType: The event type. +/// - category: The category. +/// - duration: The duration. +/// - startTime: The start time. +/// - endTime: The end time. +/// - name: The name. +/// - customFlags: The custom flags. public enum MPEventKeys: String, EnumerationListable { case eventType = "SimcoeInternalMPEventType" diff --git a/Simcoe/mParticle/MPProduct+Simcoe.swift b/Simcoe/mParticle/MPProduct+Simcoe.swift index b4ece7b..963b052 100644 --- a/Simcoe/mParticle/MPProduct+Simcoe.swift +++ b/Simcoe/mParticle/MPProduct+Simcoe.swift @@ -12,9 +12,7 @@ extension MPProduct { /// A convenience initializer. /// - /// - parameter product: A SimcoeProductConvertible instance. - /// - /// - returns: A MPProduct. + /// - Parameter product: A SimcoeProductConvertible instance. internal convenience init(product: SimcoeProductConvertible) { let simcoeProduct = product.toSimcoeProduct() self.init(name: simcoeProduct.productName, diff --git a/Simcoe/mParticle/MPProductKeys.swift b/Simcoe/mParticle/MPProductKeys.swift index 9faeca7..375b8cd 100644 --- a/Simcoe/mParticle/MPProductKeys.swift +++ b/Simcoe/mParticle/MPProductKeys.swift @@ -8,12 +8,12 @@ /// The MPProduct keys available for use with additionalProperties. /// -/// - Brand: The product brand. -/// - Category: A category to which the product belongs. -/// - CouponCode: The coupon associated with the product. -/// - Sku: The sku of the product. -/// - Position: The position of the product on the screen or impression list. -/// - Variant: The variant. +/// - brand: The product brand. +/// - category: A category to which the product belongs. +/// - couponCode: The coupon associated with the product. +/// - sku: The sku of the product. +/// - position: The position of the product on the screen or impression list. +/// - variant: The variant. public enum MPProductKeys: String, EnumerationListable { case brand = "brand" diff --git a/Simcoe/mParticle/MPTransactionAttributes+Simcoe.swift b/Simcoe/mParticle/MPTransactionAttributes+Simcoe.swift index 98212a1..972c253 100644 --- a/Simcoe/mParticle/MPTransactionAttributes+Simcoe.swift +++ b/Simcoe/mParticle/MPTransactionAttributes+Simcoe.swift @@ -25,15 +25,15 @@ extension MPTransactionAttributes { } if let revenue = properties[MPTransactionAttributesKeys.revenue.rawValue] as? Double { - self.revenue = revenue as NSNumber + self.revenue = NSNumber(value: revenue) } if let shipping = properties[MPTransactionAttributesKeys.shipping.rawValue] as? Double { - self.shipping = shipping as NSNumber + self.shipping = NSNumber(value: shipping) } if let tax = properties[MPTransactionAttributesKeys.tax.rawValue] as? Double { - self.tax = tax as NSNumber + self.tax = NSNumber(value: tax) } if let transactionId = properties[MPTransactionAttributesKeys.transactionId.rawValue] as? String { diff --git a/Simcoe/mParticle/MPTransactionAttributesKeys.swift b/Simcoe/mParticle/MPTransactionAttributesKeys.swift index 9640dc3..d8f694d 100644 --- a/Simcoe/mParticle/MPTransactionAttributesKeys.swift +++ b/Simcoe/mParticle/MPTransactionAttributesKeys.swift @@ -8,12 +8,12 @@ /// The MPTransactionAttributes keys available. /// -/// - Affiliation: The affiliation. -/// - CouponCode: The coupon code. -/// - Revenue: The revenue amount. -/// - Shipping: The shipping amount. -/// - Tax: The tax amount. -/// - TransactionId: The transaction Id. +/// - affiliation: The affiliation. +/// - couponCode: The coupon code. +/// - revenue: The revenue amount. +/// - shipping: The shipping amount. +/// - tax: The tax amount. +/// - transactionId: The transaction Id. public enum MPTransactionAttributesKeys: String, EnumerationListable { case affiliation = "affiliation" diff --git a/Simcoe/mParticle/README.md b/Simcoe/mParticle/README.md index 6b3b45a..3bbc66b 100644 --- a/Simcoe/mParticle/README.md +++ b/Simcoe/mParticle/README.md @@ -43,9 +43,9 @@ For `EventTracking` and `LocationTracking`, mParticle expects an `MPEvent` objec ```swift public func eventData(type type: MPEventType, name: String, category: String? = nil, - duration: Float? = nil, startTime: NSDate? = nil, - endTime: NSDate? = nil, customFlags: [String: [String]]? = nil, - info: [String: AnyObject]? = nil) -> [String: AnyObject] + duration: Float? = nil, startTime: Date? = nil, + endTime: Date? = nil, customFlags: [String: [String]]? = nil, + info: Properties? = nil) -> Properties ``` The two mandatory items for every `MPEvent` object are `type` and `name`, both of which are non-optional parameters. All other items of `MPEvent` are optional diff --git a/Simcoe/mParticle/mParticle.swift b/Simcoe/mParticle/mParticle.swift index eceb2a8..af99d12 100644 --- a/Simcoe/mParticle/mParticle.swift +++ b/Simcoe/mParticle/mParticle.swift @@ -9,24 +9,21 @@ import mParticle_Apple_SDK /// Simcoe Analytics handler for the MParticle iOS SDK. -open class mParticle { +public class mParticle { fileprivate static let unknownErrorMessage = "An unknown error occurred." /// The name of the tracker. open let name = "mParticle" - /** - Initializes and starts the SDK with the input key and secret. - - - parameter key: The key. - - parameter secret: The secret. - - parameter installationType: The installation type. - - parameter environment: The environment. - - parameter proxyAppDelegate: Determines if app delegate proxy should be used. - - - returns: A mParticle instance. - */ + /// Initializes and starts the SDK with the input key and secret. + /// + /// - Parameters: + /// - key: The key. + /// - secret: The secret. + /// - installationType: The installation type. + /// - environment: The environment. + /// - proxyAppDelegate: Determines if app delegate proxy should be used. public init(key: String, secret: String, installationType: MPInstallationType = .autodetect, @@ -53,10 +50,10 @@ extension mParticle: CartLogging { /// Logs the addition of a product to the cart. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. + /// - Returns: A tracking result. public func logAddToCart(_ product: T, eventProperties: Properties?) -> TrackingResult { let mPProduct = MPProduct(product: product) let event = MPCommerceEvent(eventType: .addToCart, @@ -70,10 +67,10 @@ extension mParticle: CartLogging { /// Logs the removal of a product from the cart. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. + /// - Returns: A tracking result. public func logRemoveFromCart(_ product: T, eventProperties: Properties?) -> TrackingResult { let mPProduct = MPProduct(product: product) let event = MPCommerceEvent(eventType: .removeFromCart, @@ -84,7 +81,7 @@ extension mParticle: CartLogging { return .success } - + } // MARK: - CheckoutTracking @@ -93,10 +90,10 @@ extension mParticle: CheckoutTracking { /// Tracks a checkout event. /// - /// - parameter products: The products. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - products: The products. + /// - eventProperties: The event properties. + /// - Returns: A tracking result. public func trackCheckoutEvent(_ products: [T], eventProperties: Properties?) -> TrackingResult { let mPProducts = products.map { MPProduct(product: $0) } let event = MPCommerceEvent(eventType: .checkout, @@ -114,15 +111,15 @@ extension mParticle: CheckoutTracking { extension mParticle: ErrorLogging { - /** - Logs an error through mParticle. - - It is recommended that you use the `Simcoe.eventData()` function in order to generate the properties - dictionary properly. - - - parameter error: The error to log. - - parameter properties: The properties of the event. - */ + /// Logs an error through mParticle. + /// + /// It is recommended that you use the `Simcoe.eventData()` function in order to generate the properties + /// dictionary properly. + /// + /// - Parameters: + /// - error: The error to log. + /// - properties: The properties of the event. + /// - Returns: A tracking result. public func log(error: String, withAdditionalProperties properties: Properties? = nil) -> TrackingResult { MParticle.sharedInstance().logError(error, eventInfo: properties) @@ -135,26 +132,26 @@ extension mParticle: ErrorLogging { extension mParticle: EventTracking { - /** - Tracks an mParticle event. - - Internally, this generates an MPEvent object based on the properties passed in. The event string - passed as the first parameter is delineated as the .name of the MPEvent. As a caller, you are - required to pass in non-nil properties where one of the properties is the MPEventType. Failure - to do so will cause this function to fail. - - It is recommended that you use the `Simcoe.eventData()` function in order to generate the properties - dictionary properly. - - - parameter event: The event name to log. - - parameter properties: The properties of the event. - */ + /// Tracks an mParticle event. + /// + /// Internally, this generates an MPEvent object based on the properties passed in. The event string + /// passed as the first parameter is delineated as the .name of the MPEvent. As a caller, you are + /// required to pass in non-nil properties where one of the properties is the MPEventType. Failure + /// to do so will cause this function to fail. + /// + /// It is recommended that you use the `Simcoe.eventData()` function in order to generate the properties + /// dictionary properly. + /// + /// - Parameters: + /// - event: The event name to log. + /// - properties: The properties of the event. + /// - Returns: A tracking result. public func track(event: String, withAdditionalProperties properties: Properties?) -> TrackingResult { guard var properties = properties else { return .error(message: "Cannot track an event without valid properties.") } - properties[MPEventKeys.name.rawValue] = event as AnyObject + properties[MPEventKeys.name.rawValue] = event let event: MPEvent do { @@ -176,46 +173,43 @@ extension mParticle: EventTracking { extension mParticle: LifetimeValueIncreasing { - /** - Increases the lifetime value of the key by the specified amount. - - - parameter amount: The amount to increase that lifetime value for. - - parameter item: The optional item to extend. - - parameter properties: The optional additional properties. - - - returns: A tracking result. - */ + /// Increases the lifetime value of the key by the specified amount. + /// + /// - Parameters: + /// - amount: The amount to increase that lifetime value for. + /// - item: The optional item to extend. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. public func increaseLifetimeValue(byAmount amount: Double, forItem item: String?, - withAdditionalProperties properties: Properties?) -> TrackingResult { + withAdditionalProperties properties: Properties?) -> TrackingResult { MParticle.sharedInstance().logLTVIncrease(amount, eventName: (item ?? ""), eventInfo: properties) return .success } - + } // MARK: - LocationTracking extension mParticle: LocationTracking { - /** - Tracks the user's location. - - Internally, this generates an MPEvent object based on the properties passed in. As a result, it is - required that the properties dictionary not be nil and contains keys for .name and .eventType. The latitude - and longitude of the location object passed in will automatically be added to the info dictionary of the MPEvent - object; it is recommended not to include them manually unless there are other properties required to use them. - - It is recommended that you use the `Simcoe.eventData()` function in order to generate the properties - dictionary properly. - - - parameter location: The location data being tracked. - - parameter properties: The properties for the MPEvent. - */ + /// Tracks the user's location. + /// + /// Internally, this generates an MPEvent object based on the properties passed in. As a result, it is + /// required that the properties dictionary not be nil and contains keys for .name and .eventType. The latitude + /// and longitude of the location object passed in will automatically be added to the info dictionary of the MPEvent + /// object; it is recommended not to include them manually unless there are other properties required to use them. + /// + /// It is recommended that you use the `Simcoe.eventData()` function in order to generate the properties + /// dictionary properly. + /// - Parameters: + /// - location: The location data being tracked. + /// - properties: The properties for the MPEvent. + /// - Returns: A tracking result. public func track(location: CLLocation, withAdditionalProperties properties: Properties?) -> TrackingResult { - var eventProperties = properties ?? [String: AnyObject]() // TODO: Handle Error - eventProperties["latitude"] = location.coordinate.latitude as AnyObject - eventProperties["longitude"] = location.coordinate.longitude as AnyObject + var eventProperties = properties ?? Properties() // TODO: Handle Error + eventProperties["latitude"] = String(location.coordinate.latitude) + eventProperties["longitude"] = String(location.coordinate.longitude) let event: MPEvent do { @@ -237,19 +231,18 @@ extension mParticle: LocationTracking { extension mParticle: PageViewTracking { - /** - Tracks the page view. - - - parameter pageView: The page view to track. - - - returns: A tracking result. - */ + /// Tracks the page view. + /// + /// - Parameters: + /// - pageView: The page view to track. + /// - properties: The optional additional properties. + /// - Returns: A tracking result. public func track(pageView: String, withAdditionalProperties properties: Properties?) -> TrackingResult { MParticle.sharedInstance().logScreen(pageView, eventInfo: properties) return .success } - + } // MARK: - PurchaseTracking @@ -258,10 +251,10 @@ extension mParticle: PurchaseTracking { /// Tracks a purchase event. /// - /// - parameter products: The products. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - products: The products. + /// - eventProperties: The event properties + /// - Returns: A tracking result. public func trackPurchaseEvent(_ products: [T], eventProperties: Properties?) -> TrackingResult { let mPProducts = products.map { MPProduct(product: $0) } let event = MPCommerceEvent(eventType: .purchase, @@ -272,26 +265,25 @@ extension mParticle: PurchaseTracking { return .success } - -} +} // MARK: - UserAttributeTracking extension mParticle: UserAttributeTracking { - - /** - Sets the User Attribute through mParticle. - - - parameter key: The key of the user attribute - - parameter value: the value of the user attribute - */ - public func setUserAttribute(_ key: String, value: AnyObject) -> TrackingResult { + + /// Sets the User Attribute. + /// + /// - Parameters: + /// - key: The attribute key to log. + /// - value: The attribute value to log. + /// - Returns: A tracking result. + public func setUserAttribute(_ key: String, value: Any) -> TrackingResult { MParticle.sharedInstance().setUserAttribute(key, value: value) return .success } - + } // MARK: - ViewDetailLogging @@ -300,10 +292,10 @@ extension mParticle: ViewDetailLogging { /// Logs the action of viewing a product's details. /// - /// - parameter product: The SimcoeProductConvertible instance. - /// - parameter eventProperties: The event properties. - /// - /// - returns: A tracking result. + /// - Parameters: + /// - product: The SimcoeProductConvertible instance. + /// - eventProperties: The event properties. + /// - Returns: A tracking result. public func logViewDetail(_ product: T, eventProperties: Properties?) -> TrackingResult { let mPProduct = MPProduct(product: product) let event = MPCommerceEvent(eventType: .viewDetail, @@ -314,5 +306,5 @@ extension mParticle: ViewDetailLogging { return .success } - + } diff --git a/SimcoeTests/Mocks/EventPropertiesFake.swift b/SimcoeTests/Mocks/EventPropertiesFake.swift index c009835..ce4ca1e 100644 --- a/SimcoeTests/Mocks/EventPropertiesFake.swift +++ b/SimcoeTests/Mocks/EventPropertiesFake.swift @@ -10,8 +10,8 @@ internal final class EventPropertiesFake { - static let eventProperties: Properties = ["checkoutStep": 1 as AnyObject, - "currency": "USD" as AnyObject, - "screenName": "home" as AnyObject] + static let eventProperties: Properties = ["checkoutStep": 1, + "currency": "USD", + "screenName": "home"] } diff --git a/SimcoeTests/Mocks/ProductFake.swift b/SimcoeTests/Mocks/ProductFake.swift index e936279..b31d5ee 100644 --- a/SimcoeTests/Mocks/ProductFake.swift +++ b/SimcoeTests/Mocks/ProductFake.swift @@ -18,8 +18,8 @@ internal struct ProductFake { let totalPrice: Double = 935.47 - let properties: Properties = [ "sku": 348956743 as AnyObject, - "brand": "super" as AnyObject] + let properties: Properties = [ "sku": 348956743 as Int, + "brand": "super" as String] } diff --git a/SimcoeTests/Mocks/UserAttributesFake.swift b/SimcoeTests/Mocks/UserAttributesFake.swift index fb477eb..443c5bd 100644 --- a/SimcoeTests/Mocks/UserAttributesFake.swift +++ b/SimcoeTests/Mocks/UserAttributesFake.swift @@ -14,7 +14,7 @@ internal final class UserAttributesFake: UserAttributeTracking { var attributesCallCount = 0 - func setUserAttribute(_ key: String, value: AnyObject) -> TrackingResult { + func setUserAttribute(_ key: String, value: Any) -> TrackingResult { attributesCallCount += 1 return .success } diff --git a/SimcoeTests/SimcoeLoggingTests.swift b/SimcoeTests/SimcoeLoggingTests.swift index 324343a..7e8347d 100644 --- a/SimcoeTests/SimcoeLoggingTests.swift +++ b/SimcoeTests/SimcoeLoggingTests.swift @@ -139,7 +139,7 @@ internal final class SimcoeLoggingTests: XCTestCase { simcoe.providers = [attributesSetter] let expectation = 1 - simcoe.setUserAttribute("foo", value: "bar" as AnyObject) + simcoe.setUserAttribute("foo", value: "bar" as String) XCTAssertEqual(attributesSetter.attributesCallCount, expectation, "Expected result = Called \(expectation) times; got \(attributesSetter.attributesCallCount)") diff --git a/SimcoeTests/mParticle/MPEventTests.swift b/SimcoeTests/mParticle/MPEventTests.swift index 8511fb6..7f89a38 100644 --- a/SimcoeTests/mParticle/MPEventTests.swift +++ b/SimcoeTests/mParticle/MPEventTests.swift @@ -13,9 +13,10 @@ import mParticle_Apple_SDK class MPEventTests: XCTestCase { func test_that_MPEvent_created_with_name_and_type() { - let properties: [String: AnyObject] = - [MPEventKeys.name.rawValue: "Event" as AnyObject, - MPEventKeys.eventType.rawValue: MPEventType.other.rawValue as AnyObject] + var properties = Properties() + properties[MPEventKeys.name.rawValue] = "Event" + properties[MPEventKeys.eventType.rawValue] = MPEventType.other.rawValue + let event: MPEvent? let eventError: Error? @@ -34,7 +35,9 @@ class MPEventTests: XCTestCase { } func test_that_name_error_thrown_when_missing() { - let properties: [String: AnyObject] = [MPEventKeys.eventType.rawValue: MPEventType.other.rawValue as AnyObject] + var properties = Properties() + properties[MPEventKeys.eventType.rawValue] = MPEventType.other.rawValue + let expected = MPEventGenerationError.nameMissing let event: MPEvent? let eventError: Error? @@ -54,7 +57,9 @@ class MPEventTests: XCTestCase { } func test_that_type_error_thrown_when_missing() { - let properties: [String: AnyObject] = [MPEventKeys.name.rawValue: "Test" as AnyObject] + var properties = Properties() + properties[MPEventKeys.name.rawValue] = "Test" + let expected = MPEventGenerationError.typeMissing let event: MPEvent? let eventError: Error? @@ -172,7 +177,7 @@ class MPEventTests: XCTestCase { let key = "Stuff" let value = 42 - let data = MPEvent.eventData(type: .other, name: name, info: [key: value as AnyObject]) + let data = MPEvent.eventData(type: .other, name: name, info: [key: value as Int]) let result = try! MPEvent.toEvent(usingData: data) XCTAssertNotNil(result.info, From 0847c97a17ad055f4e071cadff249d4c0403fb19 Mon Sep 17 00:00:00 2001 From: Jonathan Samudio Date: Wed, 17 May 2017 17:53:16 -0400 Subject: [PATCH 11/11] Removed mparticle media type test. --- SimcoeTests/mParticle/MPEventTests.swift | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/SimcoeTests/mParticle/MPEventTests.swift b/SimcoeTests/mParticle/MPEventTests.swift index e4ad728..6b3ed5d 100644 --- a/SimcoeTests/mParticle/MPEventTests.swift +++ b/SimcoeTests/mParticle/MPEventTests.swift @@ -98,16 +98,6 @@ class MPEventTests: XCTestCase { "Expected result = \(expected); got \(eventError)") } - func test_that_MPEvent_has_type() { - let type = MPEventType.media - - let data = MPEvent.eventData(type: type, name: "Event Type") - let result = try! MPEvent.toEvent(usingData: data) - - XCTAssertEqual(result.type, type, - "Expected result = \(type); got \(result.type)") - } - func test_that_MPEvent_has_name() { let name = "Hello, World"