diff --git a/.gitignore b/.gitignore index 239c74256..d3a8ff775 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ Carthage/Build # - Also handy if you have a large number of dependant pods # - AS PER https://guides.cocoapods.org/using/using-cocoapods.html NEVER IGNORE THE LOCK FILE Pods/ +*.lock ### Swift ### # Xcode @@ -69,9 +70,8 @@ playground.xcworkspace # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# Pods/ # Add this line if you want to avoid checking in source code from the Xcode workspace -# *.xcworkspace +*.xcworkspace # Carthage # Add this line if you want to avoid checking in source code from Carthage dependencies. diff --git a/Podfile b/Podfile deleted file mode 100644 index d17932167..000000000 --- a/Podfile +++ /dev/null @@ -1,37 +0,0 @@ -# Uncomment the next line to define a global platform for your project -platform :ios, '11.0' - -target 'PostHog' do - # Comment the next line if you don't want to use dynamic frameworks - use_frameworks! - - # Pods for PostHog - - def shared_testing_pods - pod 'Quick', '~> 1.2.0' - pod 'Nimble', '~> 9.2.0' - pod 'Nocilla', '~> 0.11.0' - pod 'Alamofire', '~> 4.5' - pod 'Alamofire-Synchronous', '~> 4.0' - end - - target 'PostHogTests' do - # Pods for testing - shared_testing_pods - end - - target 'PostHogTestsTVOS' do - # Pods for testing - shared_testing_pods - end - - post_install do |installer| - installer.generated_projects.each do |project| - project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0' - end - end - end - end -end diff --git a/PostHog.podspec b/PostHog.podspec index 00537744c..caedaafcd 100644 --- a/PostHog.podspec +++ b/PostHog.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "PostHog" - s.version = "2.1.0" + s.version = "3.0.0-alpha.1" s.summary = "The hassle-free way to add posthog to your iOS app." s.description = <<-DESC @@ -10,19 +10,18 @@ Pod::Spec.new do |s| s.homepage = "http://posthog.com/" s.license = { :type => 'MIT' } - s.author = { "PostHog" => "tim@posthog.com" } + s.author = { "PostHog" => "engineering@posthog.com" } s.source = { :git => "https://github.com/PostHog/posthog-ios.git", :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/PostHog' - s.ios.deployment_target = '11.0' - s.tvos.deployment_target = '11.0' + s.ios.deployment_target = '13.0' + s.tvos.deployment_target = '13.0' + s.osx.deployment_target = "10.14" + s.swift_versions = "5.3" - s.ios.frameworks = 'CoreTelephony' - s.frameworks = 'Security', 'StoreKit', 'SystemConfiguration', 'UIKit' + s.frameworks = 'Foundation' s.source_files = [ - 'PostHog/Classes/**/*', - 'PostHog/Internal/**/*', - 'PostHog/Vendor/**/*' + 'PostHog/**/*' ] end diff --git a/PostHog.xcodeproj/project.pbxproj b/PostHog.xcodeproj/project.pbxproj index e6d5a564c..9b896f59a 100644 --- a/PostHog.xcodeproj/project.pbxproj +++ b/PostHog.xcodeproj/project.pbxproj @@ -88,6 +88,13 @@ remoteGlobalIDString = 3AC745B4296D6FE60025C109; remoteInfo = PostHog; }; + 690FF0332AE7C5BB00A0B06B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 690FF02F2AE7C5BA00A0B06B /* PostHogExampleWithPods.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 690FF01E2AE7C5B900A0B06B; + remoteInfo = PostHogExampleWithPods; + }; 69278D4D2AE6BC9000BB541A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 3AC745AC296D6FE60025C109 /* Project object */; @@ -160,6 +167,7 @@ 3AE3FB48299391DF00AFFC18 /* PostHogStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogStorage.swift; sourceTree = ""; }; 3AE3FB4A2993A68500AFFC18 /* StorageTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorageTest.swift; sourceTree = ""; }; 3AE3FB4D2993D1D600AFFC18 /* PostHogSessionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogSessionManager.swift; sourceTree = ""; }; + 690FF02F2AE7C5BA00A0B06B /* PostHogExampleWithPods.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PostHogExampleWithPods.xcodeproj; path = PostHogExampleWithPods/PostHogExampleWithPods.xcodeproj; sourceTree = ""; }; 69261D122AD5685B00232EC7 /* PostHogFeatureFlags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogFeatureFlags.swift; sourceTree = ""; }; 69261D182AD9673500232EC7 /* PostHogBatchUploadInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogBatchUploadInfo.swift; sourceTree = ""; }; 69261D1A2AD9678C00232EC7 /* PostHogEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogEvent.swift; sourceTree = ""; }; @@ -283,6 +291,7 @@ 3AC745AB296D6FE60025C109 = { isa = PBXGroup; children = ( + 690FF02F2AE7C5BA00A0B06B /* PostHogExampleWithPods.xcodeproj */, 3AAFB13129C0C699004F485B /* Package.swift */, 3AC745B7296D6FE60025C109 /* PostHog */, 3AC745C3296D6FE60025C109 /* PostHogTests */, @@ -342,6 +351,14 @@ path = PostHogTests; sourceTree = ""; }; + 690FF0302AE7C5BA00A0B06B /* Products */ = { + isa = PBXGroup; + children = ( + 690FF0342AE7C5BB00A0B06B /* PostHogExampleWithPods.app */, + ); + name = Products; + sourceTree = ""; + }; 69261D152AD92D6C00232EC7 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -517,6 +534,12 @@ ); productRefGroup = 3AC745B6296D6FE60025C109 /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 690FF0302AE7C5BA00A0B06B /* Products */; + ProjectRef = 690FF02F2AE7C5BA00A0B06B /* PostHogExampleWithPods.xcodeproj */; + }, + ); projectRoot = ""; targets = ( 3AC745B4296D6FE60025C109 /* PostHog */, @@ -527,6 +550,16 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 690FF0342AE7C5BB00A0B06B /* PostHogExampleWithPods.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = PostHogExampleWithPods.app; + remoteRef = 690FF0332AE7C5BB00A0B06B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 3AA34CF5296D951A003398F4 /* Resources */ = { isa = PBXResourcesBuildPhase; diff --git a/PostHog/PostHogDataMode.swift b/PostHog/PostHogDataMode.swift deleted file mode 100644 index 5418eda14..000000000 --- a/PostHog/PostHogDataMode.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// PostHogDataMode.swift -// PostHog -// -// Created by Manoel Aranda Neto on 13.10.23. -// - -import Foundation - -@objc(PostHogDataMode) public enum PostHogDataMode: Int { - case wifi - case cellular - case any -} diff --git a/PostHog/PostHogVersion.swift b/PostHog/PostHogVersion.swift index 1121a371b..1e2bac0b2 100644 --- a/PostHog/PostHogVersion.swift +++ b/PostHog/PostHogVersion.swift @@ -7,4 +7,4 @@ import Foundation -let postHogVersion = "3.0.0" +let postHogVersion = "3.0.0-alpha.1" diff --git a/PostHogExampleWithPods/Podfile b/PostHogExampleWithPods/Podfile new file mode 100644 index 000000000..cddbc24f2 --- /dev/null +++ b/PostHogExampleWithPods/Podfile @@ -0,0 +1,7 @@ +platform :ios, '16.0' + +use_frameworks! + +target 'PostHogExampleWithPods' do + pod 'PostHog', :path => '../' +end diff --git a/PostHogExampleWithPods/PostHogExampleWithPods.xcodeproj/project.pbxproj b/PostHogExampleWithPods/PostHogExampleWithPods.xcodeproj/project.pbxproj new file mode 100644 index 000000000..d9b7e46a7 --- /dev/null +++ b/PostHogExampleWithPods/PostHogExampleWithPods.xcodeproj/project.pbxproj @@ -0,0 +1,423 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + 690FF0222AE7C5B900A0B06B /* PostHogExampleWithPodsApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690FF0212AE7C5B900A0B06B /* PostHogExampleWithPodsApp.swift */; }; + 690FF0242AE7C5B900A0B06B /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690FF0232AE7C5B900A0B06B /* ContentView.swift */; }; + 690FF0262AE7C5BA00A0B06B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 690FF0252AE7C5BA00A0B06B /* Assets.xcassets */; }; + 690FF0292AE7C5BA00A0B06B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 690FF0282AE7C5BA00A0B06B /* Preview Assets.xcassets */; }; + 690FF0362AE7C61300A0B06B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690FF0352AE7C61300A0B06B /* AppDelegate.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 232850674C6F805AF056B5E2 /* Pods_PostHogExampleWithPods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PostHogExampleWithPods.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 690FF01E2AE7C5B900A0B06B /* PostHogExampleWithPods.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PostHogExampleWithPods.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 690FF0212AE7C5B900A0B06B /* PostHogExampleWithPodsApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogExampleWithPodsApp.swift; sourceTree = ""; }; + 690FF0232AE7C5B900A0B06B /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 690FF0252AE7C5BA00A0B06B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 690FF0282AE7C5BA00A0B06B /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 690FF0352AE7C61300A0B06B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + A7382F16B47BF30B43A4A8D0 /* Pods-PostHogExampleWithPods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PostHogExampleWithPods.release.xcconfig"; path = "Target Support Files/Pods-PostHogExampleWithPods/Pods-PostHogExampleWithPods.release.xcconfig"; sourceTree = ""; }; + E20DD4077C3254D69E55F5E4 /* Pods-PostHogExampleWithPods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PostHogExampleWithPods.debug.xcconfig"; path = "Target Support Files/Pods-PostHogExampleWithPods/Pods-PostHogExampleWithPods.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 690FF01B2AE7C5B900A0B06B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 40EAAE95CA89DD225C1A62CA /* Pods */ = { + isa = PBXGroup; + children = ( + E20DD4077C3254D69E55F5E4 /* Pods-PostHogExampleWithPods.debug.xcconfig */, + A7382F16B47BF30B43A4A8D0 /* Pods-PostHogExampleWithPods.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + 51304F7636270ABD9ECC9BB4 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 232850674C6F805AF056B5E2 /* Pods_PostHogExampleWithPods.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 690FF0152AE7C5B900A0B06B = { + isa = PBXGroup; + children = ( + 690FF0202AE7C5B900A0B06B /* PostHogExampleWithPods */, + 690FF01F2AE7C5B900A0B06B /* Products */, + 40EAAE95CA89DD225C1A62CA /* Pods */, + 51304F7636270ABD9ECC9BB4 /* Frameworks */, + ); + sourceTree = ""; + }; + 690FF01F2AE7C5B900A0B06B /* Products */ = { + isa = PBXGroup; + children = ( + 690FF01E2AE7C5B900A0B06B /* PostHogExampleWithPods.app */, + ); + name = Products; + sourceTree = ""; + }; + 690FF0202AE7C5B900A0B06B /* PostHogExampleWithPods */ = { + isa = PBXGroup; + children = ( + 690FF0352AE7C61300A0B06B /* AppDelegate.swift */, + 690FF0212AE7C5B900A0B06B /* PostHogExampleWithPodsApp.swift */, + 690FF0232AE7C5B900A0B06B /* ContentView.swift */, + 690FF0252AE7C5BA00A0B06B /* Assets.xcassets */, + 690FF0272AE7C5BA00A0B06B /* Preview Content */, + ); + path = PostHogExampleWithPods; + sourceTree = ""; + }; + 690FF0272AE7C5BA00A0B06B /* Preview Content */ = { + isa = PBXGroup; + children = ( + 690FF0282AE7C5BA00A0B06B /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 690FF01D2AE7C5B900A0B06B /* PostHogExampleWithPods */ = { + isa = PBXNativeTarget; + buildConfigurationList = 690FF02C2AE7C5BA00A0B06B /* Build configuration list for PBXNativeTarget "PostHogExampleWithPods" */; + buildPhases = ( + E529A676C25D212940D59F59 /* [CP] Check Pods Manifest.lock */, + 690FF01A2AE7C5B900A0B06B /* Sources */, + 690FF01B2AE7C5B900A0B06B /* Frameworks */, + 690FF01C2AE7C5B900A0B06B /* Resources */, + 309133969B05247D96BFB94E /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PostHogExampleWithPods; + productName = PostHogExampleWithPods; + productReference = 690FF01E2AE7C5B900A0B06B /* PostHogExampleWithPods.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 690FF0162AE7C5B900A0B06B /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1500; + LastUpgradeCheck = 1500; + TargetAttributes = { + 690FF01D2AE7C5B900A0B06B = { + CreatedOnToolsVersion = 15.0.1; + }; + }; + }; + buildConfigurationList = 690FF0192AE7C5B900A0B06B /* Build configuration list for PBXProject "PostHogExampleWithPods" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 690FF0152AE7C5B900A0B06B; + productRefGroup = 690FF01F2AE7C5B900A0B06B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 690FF01D2AE7C5B900A0B06B /* PostHogExampleWithPods */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 690FF01C2AE7C5B900A0B06B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 690FF0292AE7C5BA00A0B06B /* Preview Assets.xcassets in Resources */, + 690FF0262AE7C5BA00A0B06B /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 309133969B05247D96BFB94E /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-PostHogExampleWithPods/Pods-PostHogExampleWithPods-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-PostHogExampleWithPods/Pods-PostHogExampleWithPods-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PostHogExampleWithPods/Pods-PostHogExampleWithPods-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + E529A676C25D212940D59F59 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-PostHogExampleWithPods-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 690FF01A2AE7C5B900A0B06B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 690FF0362AE7C61300A0B06B /* AppDelegate.swift in Sources */, + 690FF0242AE7C5B900A0B06B /* ContentView.swift in Sources */, + 690FF0222AE7C5B900A0B06B /* PostHogExampleWithPodsApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 690FF02A2AE7C5BA00A0B06B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 690FF02B2AE7C5BA00A0B06B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 690FF02D2AE7C5BA00A0B06B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E20DD4077C3254D69E55F5E4 /* Pods-PostHogExampleWithPods.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"PostHogExampleWithPods/Preview Content\""; + DEVELOPMENT_TEAM = PNC2XCH2XP; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.posthog.PostHogExampleWithPods; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 690FF02E2AE7C5BA00A0B06B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = A7382F16B47BF30B43A4A8D0 /* Pods-PostHogExampleWithPods.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"PostHogExampleWithPods/Preview Content\""; + DEVELOPMENT_TEAM = PNC2XCH2XP; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.posthog.PostHogExampleWithPods; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 690FF0192AE7C5B900A0B06B /* Build configuration list for PBXProject "PostHogExampleWithPods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 690FF02A2AE7C5BA00A0B06B /* Debug */, + 690FF02B2AE7C5BA00A0B06B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 690FF02C2AE7C5BA00A0B06B /* Build configuration list for PBXNativeTarget "PostHogExampleWithPods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 690FF02D2AE7C5BA00A0B06B /* Debug */, + 690FF02E2AE7C5BA00A0B06B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 690FF0162AE7C5B900A0B06B /* Project object */; +} diff --git a/PostHogExampleWithPods/PostHogExampleWithPods.xcodeproj/xcshareddata/xcschemes/PostHogExampleWithPods.xcscheme b/PostHogExampleWithPods/PostHogExampleWithPods.xcodeproj/xcshareddata/xcschemes/PostHogExampleWithPods.xcscheme new file mode 100644 index 000000000..9ba9737cc --- /dev/null +++ b/PostHogExampleWithPods/PostHogExampleWithPods.xcodeproj/xcshareddata/xcschemes/PostHogExampleWithPods.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PostHogExampleWithPods/PostHogExampleWithPods/AppDelegate.swift b/PostHogExampleWithPods/PostHogExampleWithPods/AppDelegate.swift new file mode 100644 index 000000000..e8c2c0cb4 --- /dev/null +++ b/PostHogExampleWithPods/PostHogExampleWithPods/AppDelegate.swift @@ -0,0 +1,35 @@ +// +// AppDelegate.swift +// PostHogExampleWithPods +// +// Created by Manoel Aranda Neto on 24.10.23. +// + +import Foundation +import PostHog +import UIKit + +class AppDelegate: NSObject, UIApplicationDelegate { + func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { + let defaultCenter = NotificationCenter.default + + defaultCenter.addObserver(self, + selector: #selector(receiveFeatureFlags), + name: PostHogSDK.didReceiveFeatureFlags, + object: nil) + + let config = PostHogConfig( + apiKey: "_6SG-F7I1vCuZ-HdJL3VZQqjBlaSb1_20hDPwqMNnGI" + ) + + PostHogSDK.shared.setup(config) + PostHogSDK.shared.debug() + PostHogSDK.shared.capture("Event from CocoaPods example!") + + return true + } + + @objc func receiveFeatureFlags() { + print("receiveFeatureFlags") + } +} diff --git a/PostHogExampleWithPods/PostHogExampleWithPods/Assets.xcassets/AccentColor.colorset/Contents.json b/PostHogExampleWithPods/PostHogExampleWithPods/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 000000000..eb8789700 --- /dev/null +++ b/PostHogExampleWithPods/PostHogExampleWithPods/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PostHogExampleWithPods/PostHogExampleWithPods/Assets.xcassets/AppIcon.appiconset/Contents.json b/PostHogExampleWithPods/PostHogExampleWithPods/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..13613e3ee --- /dev/null +++ b/PostHogExampleWithPods/PostHogExampleWithPods/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PostHogExampleWithPods/PostHogExampleWithPods/Assets.xcassets/Contents.json b/PostHogExampleWithPods/PostHogExampleWithPods/Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/PostHogExampleWithPods/PostHogExampleWithPods/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PostHogExampleWithPods/PostHogExampleWithPods/ContentView.swift b/PostHogExampleWithPods/PostHogExampleWithPods/ContentView.swift new file mode 100644 index 000000000..3ae9c1062 --- /dev/null +++ b/PostHogExampleWithPods/PostHogExampleWithPods/ContentView.swift @@ -0,0 +1,24 @@ +// +// ContentView.swift +// PostHogExampleWithPods +// +// Created by Manoel Aranda Neto on 24.10.23. +// + +import SwiftUI + +struct ContentView: View { + var body: some View { + VStack { + Image(systemName: "globe") + .imageScale(.large) + .foregroundStyle(.tint) + Text("Hello, world!") + } + .padding() + } +} + +#Preview { + ContentView() +} diff --git a/PostHogExampleWithPods/PostHogExampleWithPods/PostHogExampleWithPodsApp.swift b/PostHogExampleWithPods/PostHogExampleWithPods/PostHogExampleWithPodsApp.swift new file mode 100644 index 000000000..45d302730 --- /dev/null +++ b/PostHogExampleWithPods/PostHogExampleWithPods/PostHogExampleWithPodsApp.swift @@ -0,0 +1,19 @@ +// +// PostHogExampleWithPodsApp.swift +// PostHogExampleWithPods +// +// Created by Manoel Aranda Neto on 24.10.23. +// + +import SwiftUI + +@main +struct PostHogExampleWithPodsApp: App { + @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate + + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/PostHogExampleWithPods/PostHogExampleWithPods/Preview Content/Preview Assets.xcassets/Contents.json b/PostHogExampleWithPods/PostHogExampleWithPods/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/PostHogExampleWithPods/PostHogExampleWithPods/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PostHogExampleWithPods/README.md b/PostHogExampleWithPods/README.md new file mode 100644 index 000000000..7d599ec63 --- /dev/null +++ b/PostHogExampleWithPods/README.md @@ -0,0 +1,39 @@ +# Example with CocoaPods + +This is an example of how to use the PostHog iOS SDK with CocoaPods. + +## Installation + +1. Install CocoaPods if you haven't already: + + + +```bash +sudo gem install cocoapods +``` + +## Add a Podfile to the project + + + +```text +platform :ios, '16.0' + +use_frameworks! + +target '$your_project' do + pod 'PostHog', '~> 3.0.0' +end +``` + +Replace `$your_project` to your project name. + +## Run `pod install` + +```bash +pod install +``` + +## Open the project + +Always open the `*.xcworkspace` file, not the `*.xcodeproj` file.