From 75a686f1cac699fe88e0af207a1c80901874c5bb Mon Sep 17 00:00:00 2001 From: Ioannis J <yiannis@posthog.com> Date: Tue, 28 Jan 2025 20:27:33 +0200 Subject: [PATCH] fix: xcframework builds (#288) * fix: xcframework builds * fix: import access level * feat: add sample xcframework project * fix: build examples * chore: update CHANGELOG --- CHANGELOG.md | 1 + Makefile | 60 +-- Package.swift | 4 - PostHog/Utils/UIImage+WebP.swift | 7 +- PostHogExampleExternalSDK/ExternalSDK.swift | 34 ++ .../ExternalSDK/ExternalSDK.h | 18 + PostHogExampleExternalSDK/Package.swift | 28 ++ .../project.pbxproj | 423 ++++++++++++++++++ .../xcschemes/ExternalSDK.xcscheme | 67 +++ .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 85 ++++ .../Assets.xcassets/Contents.json | 6 + .../ExternalSDKClient/ContentView.swift | 28 ++ .../ExternalSDKClient.entitlements | 10 + .../ExternalSDKClientApp.swift | 17 + .../Preview Assets.xcassets/Contents.json | 6 + .../project.pbxproj | 379 ++++++++++++++++ .../ExternalSDK-iOS/ExternalSDK-iOS.swift | 1 + .../build_xcframework.sh | 51 +++ 19 files changed, 1205 insertions(+), 31 deletions(-) create mode 100644 PostHogExampleExternalSDK/ExternalSDK.swift create mode 100644 PostHogExampleExternalSDK/ExternalSDK/ExternalSDK.h create mode 100644 PostHogExampleExternalSDK/Package.swift create mode 100644 PostHogExampleExternalSDK/PostHogExampleExternalSDK.xcodeproj/project.pbxproj create mode 100644 PostHogExampleExternalSDK/PostHogExampleExternalSDK.xcodeproj/xcshareddata/xcschemes/ExternalSDK.xcscheme create mode 100644 PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Assets.xcassets/Contents.json create mode 100644 PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/ContentView.swift create mode 100644 PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/ExternalSDKClient.entitlements create mode 100644 PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/ExternalSDKClientApp.swift create mode 100644 PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 PostHogExampleExternalSDK/SDKClient/PostHogExampleExternalSDKClient.xcodeproj/project.pbxproj create mode 100644 PostHogExampleExternalSDK/Sources/ExternalSDK-iOS/ExternalSDK-iOS.swift create mode 100755 PostHogExampleExternalSDK/build_xcframework.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 17741d906..695a19755 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Next +- fix: XCFramework builds failing ([#288](https://github.com/PostHog/posthog-ios/pull/288)) - chore: Session Replay GA ([#286](https://github.com/PostHog/posthog-ios/pull/286)) ## 3.19.1 - 2025-01-13 diff --git a/Makefile b/Makefile index b10a9ecdd..cc4fb62e3 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,13 @@ buildSdk: set -o pipefail && xcrun xcodebuild clean build -scheme PostHog -destination generic/platform=watchos | xcpretty #watchOS set -o pipefail && xcrun xcodebuild clean build -scheme PostHog -destination 'platform=visionOS Simulator,name=Apple Vision Pro' | xcpretty #visionOS -buildExamples: +buildExamples: \ + buildExamplesPlatforms \ + buildExampleXCFramework \ + buildExamplePodsDynamic \ + buildExamplePodsStatic \ + +buildExamplesPlatforms: set -o pipefail && xcrun xcodebuild -downloadAllPlatforms set -o pipefail && xcrun xcodebuild clean build -scheme PostHogExample -destination generic/platform=ios | xcpretty #ios set -o pipefail && xcrun xcodebuild clean build -scheme PostHogExample -destination 'platform=visionOS Simulator,name=Apple Vision Pro' | xcpretty #visionOS @@ -21,33 +27,35 @@ buildExamples: set -o pipefail && xcrun xcodebuild clean build -scheme PostHogExampleTvOS -destination generic/platform=tvos | xcpretty #watchOS set -o pipefail && xcrun xcodebuild clean build -scheme PostHogExampleWithSPM -destination generic/platform=ios | xcpretty #SPM - ## Build with dynamic framework - cd PostHogExampleWithPods && \ - pod install && \ - cd .. && \ - xcrun xcodebuild clean build \ - -workspace PostHogExampleWithPods/PostHogExampleWithPods.xcworkspace \ - -scheme PostHogExampleWithPods \ - -destination generic/platform=ios | xcpretty - - ## Build with static library +buildExamplePodsDynamic: + cd PostHogExampleWithPods && pod install && cd .. && \ + set -o pipefail && xcrun xcodebuild clean build \ + -workspace PostHogExampleWithPods/PostHogExampleWithPods.xcworkspace \ + -scheme PostHogExampleWithPods \ + -destination generic/platform=ios | xcpretty + +buildExamplePodsStatic: cd PostHogExampleWithPods && \ - cp Podfile{,.backup} && \ - cp Podfile.static Podfile && \ - cp PostHogExampleWithPods.xcodeproj/project.pbxproj{,.backup} && \ - pod install && \ - cd .. && \ - xcrun xcodebuild clean build \ - -workspace PostHogExampleWithPods/PostHogExampleWithPods.xcworkspace \ - -scheme PostHogExampleWithPods \ - -destination generic/platform=ios | xcpretty - - ## Restore original files + cp Podfile{,.backup} && \ + cp Podfile.static Podfile && \ + cp PostHogExampleWithPods.xcodeproj/project.pbxproj{,.backup} && \ + pod install && \ + cd .. && \ + set -o pipefail && xcrun xcodebuild clean build \ + -workspace PostHogExampleWithPods/PostHogExampleWithPods.xcworkspace \ + -scheme PostHogExampleWithPods \ + -destination generic/platform=ios | xcpretty && \ cd PostHogExampleWithPods && \ - mv Podfile{.backup,} && \ - pod install && \ - mv PostHogExampleWithPods.xcodeproj/project.pbxproj{.backup,} - + mv Podfile{.backup,} && \ + pod install && \ + mv PostHogExampleWithPods.xcodeproj/project.pbxproj{.backup,} + +buildExampleXCFramework: + ./PostHogExampleExternalSDK/build_xcframework.sh + set -o pipefail && xcrun xcodebuild clean build \ + -project ./PostHogExampleExternalSDK/SDKClient/PostHogExampleExternalSDKClient.xcodeproj \ + -scheme ExternalSDKClient \ + -destination "generic/platform=iOS Simulator" | xcpretty format: swiftLint swiftFormat diff --git a/Package.swift b/Package.swift index 7910e216a..91d46cb4c 100644 --- a/Package.swift +++ b/Package.swift @@ -13,10 +13,6 @@ let package = Package( name: "PostHog", targets: ["PostHog"] ), - .library( - name: "phlibwebp", - targets: ["phlibwebp"] - ), ], dependencies: [ // Dependencies declare other packages that this package depends on. diff --git a/PostHog/Utils/UIImage+WebP.swift b/PostHog/Utils/UIImage+WebP.swift index 5aff2499f..377f0bd6d 100644 --- a/PostHog/Utils/UIImage+WebP.swift +++ b/PostHog/Utils/UIImage+WebP.swift @@ -12,7 +12,12 @@ import Foundation #if canImport(phlibwebp) // SPM package is linked via a lib since mix-code is not yet supported - import phlibwebp + + // `internal import`: added in Swift 5.9 and it's the "official" feature. Should replace when we switch to swift-tools-version:5.9 + // see: (https://github.com/swiftlang/swift-evolution/blob/main/proposals/0409-access-level-on-imports.md) + + // @_implementationOnly: available since Swift 5.1 + @_implementationOnly import phlibwebp #endif import UIKit diff --git a/PostHogExampleExternalSDK/ExternalSDK.swift b/PostHogExampleExternalSDK/ExternalSDK.swift new file mode 100644 index 000000000..fe037b5d5 --- /dev/null +++ b/PostHogExampleExternalSDK/ExternalSDK.swift @@ -0,0 +1,34 @@ +// +// ExternalSDK.swift +// ExternalSDK +// +// Created by Yiannis Josephides on 24/01/2025. +// + +import Foundation +import PostHog + +public final class MyExternalSDK { + public static let shared = MyExternalSDK() + + private init() { + let config = PostHogConfig( + apiKey: "phc_QFbR1y41s5sxnNTZoyKG2NJo2RlsCIWkUfdpawgb40D" + ) + + config.captureScreenViews = true + config.captureApplicationLifecycleEvents = true + config.debug = true + config.sendFeatureFlagEvent = false + config.sessionReplay = true + config.sessionReplayConfig.maskAllImages = false + config.sessionReplayConfig.maskAllTextInputs = false + config.sessionReplayConfig.maskAllSandboxedViews = false + + PostHogSDK.shared.setup(config) + } + + public func track(event: String) { + PostHogSDK.shared.capture("An Event From ExternalSDK - \(event)") + } +} diff --git a/PostHogExampleExternalSDK/ExternalSDK/ExternalSDK.h b/PostHogExampleExternalSDK/ExternalSDK/ExternalSDK.h new file mode 100644 index 000000000..39ddb6dc4 --- /dev/null +++ b/PostHogExampleExternalSDK/ExternalSDK/ExternalSDK.h @@ -0,0 +1,18 @@ +// +// ExternalSDK.h +// ExternalSDK +// +// Created by Yiannis Josephides on 23/01/2025. +// + +#import <Foundation/Foundation.h> + +//! Project version number for ExternalSDK. +FOUNDATION_EXPORT double ExternalSDKVersionNumber; + +//! Project version string for TestBuildIssues. +FOUNDATION_EXPORT const unsigned char ExternalSDKVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import <TestBuildIssues/PublicHeader.h> + + diff --git a/PostHogExampleExternalSDK/Package.swift b/PostHogExampleExternalSDK/Package.swift new file mode 100644 index 000000000..ad256dac2 --- /dev/null +++ b/PostHogExampleExternalSDK/Package.swift @@ -0,0 +1,28 @@ +// swift-tools-version: 5.10 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "ExternalSDK", + platforms: [.iOS(.v15)], + products: [ + .library( + name: "ExternalSDK", + targets: ["ExternalSDK-iOS"] + ), + ], + dependencies: [ + .package(path: "../"), + ], + targets: [ + .target( + name: "ExternalSDK-iOS", + dependencies: [ + .product(name: "PostHog", package: "posthog-ios"), + .target(name: "ExternalSDK"), + ] + ), + .binaryTarget(name: "ExternalSDK", path: "./build/bin/ExternalSDK.xcframework"), + ] +) diff --git a/PostHogExampleExternalSDK/PostHogExampleExternalSDK.xcodeproj/project.pbxproj b/PostHogExampleExternalSDK/PostHogExampleExternalSDK.xcodeproj/project.pbxproj new file mode 100644 index 000000000..50cd8fd25 --- /dev/null +++ b/PostHogExampleExternalSDK/PostHogExampleExternalSDK.xcodeproj/project.pbxproj @@ -0,0 +1,423 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + DA5CC5B62D43C54C0060722B /* PostHog in Frameworks */ = {isa = PBXBuildFile; productRef = DA5CC5B52D43C54C0060722B /* PostHog */; }; + DA5DBDDB2D43DDEA0077B419 /* PostHog in Frameworks */ = {isa = PBXBuildFile; productRef = DA5DBDDA2D43DDEA0077B419 /* PostHog */; }; + DAA5EE002D42761F00D437E0 /* PostHog in Frameworks */ = {isa = PBXBuildFile; productRef = DAA5EDFF2D42761F00D437E0 /* PostHog */; }; + DAA5EE662D4376EB00D437E0 /* ExternalSDK.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAA5EE652D4376E600D437E0 /* ExternalSDK.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + DAA5EDF12D42761400D437E0 /* ExternalSDK.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExternalSDK.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + DAA5EE652D4376E600D437E0 /* ExternalSDK.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalSDK.swift; sourceTree = "<group>"; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + DAA5EDF82D42761400D437E0 /* Exceptions for "ExternalSDK" folder in "ExternalSDK" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + publicHeaders = ( + ExternalSDK.h, + ); + target = DAA5EDF02D42761400D437E0 /* ExternalSDK */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + DAA5EDF32D42761400D437E0 /* ExternalSDK */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + DAA5EDF82D42761400D437E0 /* Exceptions for "ExternalSDK" folder in "ExternalSDK" target */, + ); + path = ExternalSDK; + sourceTree = "<group>"; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + DAA5EDEE2D42761400D437E0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + DA5DBDDB2D43DDEA0077B419 /* PostHog in Frameworks */, + DAA5EE002D42761F00D437E0 /* PostHog in Frameworks */, + DA5CC5B62D43C54C0060722B /* PostHog in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + DAA5EDE72D42761400D437E0 = { + isa = PBXGroup; + children = ( + DAA5EE652D4376E600D437E0 /* ExternalSDK.swift */, + DAA5EDF32D42761400D437E0 /* ExternalSDK */, + DAA5EDF22D42761400D437E0 /* Products */, + ); + sourceTree = "<group>"; + }; + DAA5EDF22D42761400D437E0 /* Products */ = { + isa = PBXGroup; + children = ( + DAA5EDF12D42761400D437E0 /* ExternalSDK.framework */, + ); + name = Products; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + DAA5EDEC2D42761400D437E0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + DAA5EDF02D42761400D437E0 /* ExternalSDK */ = { + isa = PBXNativeTarget; + buildConfigurationList = DAA5EDF92D42761400D437E0 /* Build configuration list for PBXNativeTarget "ExternalSDK" */; + buildPhases = ( + DAA5EDEC2D42761400D437E0 /* Headers */, + DAA5EDED2D42761400D437E0 /* Sources */, + DAA5EDEE2D42761400D437E0 /* Frameworks */, + DAA5EDEF2D42761400D437E0 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + DAA5EDF32D42761400D437E0 /* ExternalSDK */, + ); + name = ExternalSDK; + packageProductDependencies = ( + DAA5EDFF2D42761F00D437E0 /* PostHog */, + DA5CC5B52D43C54C0060722B /* PostHog */, + DA5DBDDA2D43DDEA0077B419 /* PostHog */, + ); + productName = TestBuildIssues; + productReference = DAA5EDF12D42761400D437E0 /* ExternalSDK.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + DAA5EDE82D42761400D437E0 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastUpgradeCheck = 1620; + TargetAttributes = { + DAA5EDF02D42761400D437E0 = { + CreatedOnToolsVersion = 16.2; + }; + }; + }; + buildConfigurationList = DAA5EDEB2D42761400D437E0 /* Build configuration list for PBXProject "PostHogExampleExternalSDK" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = DAA5EDE72D42761400D437E0; + minimizedProjectReferenceProxies = 1; + packageReferences = ( + DA5DBDD92D43DDEA0077B419 /* XCRemoteSwiftPackageReference "posthog-ios" */, + ); + preferredProjectObjectVersion = 77; + productRefGroup = DAA5EDF22D42761400D437E0 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + DAA5EDF02D42761400D437E0 /* ExternalSDK */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + DAA5EDEF2D42761400D437E0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + DAA5EDED2D42761400D437E0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DAA5EE662D4376EB00D437E0 /* ExternalSDK.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + DAA5EDFA2D42761400D437E0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LD_RUNPATH_SEARCH_PATHS = ( + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = ( + "@executable_path/../Frameworks", + "@loader_path/Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 15.1; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + PRODUCT_BUNDLE_IDENTIFIER = com.posthog.example.ExampleSDK; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = auto; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_INSTALL_OBJC_HEADER = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,7"; + XROS_DEPLOYMENT_TARGET = 2.2; + }; + name = Debug; + }; + DAA5EDFB2D42761400D437E0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LD_RUNPATH_SEARCH_PATHS = ( + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = ( + "@executable_path/../Frameworks", + "@loader_path/Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 15.1; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + PRODUCT_BUNDLE_IDENTIFIER = com.posthog.example.ExampleSDK; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = auto; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_INSTALL_OBJC_HEADER = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,7"; + XROS_DEPLOYMENT_TARGET = 2.2; + }; + name = Release; + }; + DAA5EDFC2D42761400D437E0 /* 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; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + DAA5EDFD2D42761400D437E0 /* 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; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SWIFT_COMPILATION_MODE = wholemodule; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + DAA5EDEB2D42761400D437E0 /* Build configuration list for PBXProject "PostHogExampleExternalSDK" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DAA5EDFC2D42761400D437E0 /* Debug */, + DAA5EDFD2D42761400D437E0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DAA5EDF92D42761400D437E0 /* Build configuration list for PBXNativeTarget "ExternalSDK" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DAA5EDFA2D42761400D437E0 /* Debug */, + DAA5EDFB2D42761400D437E0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + DA5DBDD92D43DDEA0077B419 /* XCRemoteSwiftPackageReference "posthog-ios" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/postHog/posthog-ios"; + requirement = { + branch = "fix/internal-phlibwebp"; + kind = branch; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + DA5CC5B52D43C54C0060722B /* PostHog */ = { + isa = XCSwiftPackageProductDependency; + productName = PostHog; + }; + DA5DBDDA2D43DDEA0077B419 /* PostHog */ = { + isa = XCSwiftPackageProductDependency; + package = DA5DBDD92D43DDEA0077B419 /* XCRemoteSwiftPackageReference "posthog-ios" */; + productName = PostHog; + }; + DAA5EDFF2D42761F00D437E0 /* PostHog */ = { + isa = XCSwiftPackageProductDependency; + productName = PostHog; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = DAA5EDE82D42761400D437E0 /* Project object */; +} diff --git a/PostHogExampleExternalSDK/PostHogExampleExternalSDK.xcodeproj/xcshareddata/xcschemes/ExternalSDK.xcscheme b/PostHogExampleExternalSDK/PostHogExampleExternalSDK.xcodeproj/xcshareddata/xcschemes/ExternalSDK.xcscheme new file mode 100644 index 000000000..9bcc9240c --- /dev/null +++ b/PostHogExampleExternalSDK/PostHogExampleExternalSDK.xcodeproj/xcshareddata/xcschemes/ExternalSDK.xcscheme @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "1620" + version = "1.7"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES" + buildArchitectures = "Automatic"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "DAA5EDF02D42761400D437E0" + BuildableName = "ExternalSDK.framework" + BlueprintName = "ExternalSDK" + ReferencedContainer = "container:PostHogExampleExternalSDK.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES" + shouldAutocreateTestPlan = "YES"> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "DAA5EDF02D42761400D437E0" + BuildableName = "ExternalSDK.framework" + BlueprintName = "ExternalSDK" + ReferencedContainer = "container:PostHogExampleExternalSDK.xcodeproj"> + </BuildableReference> + </MacroExpansion> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Assets.xcassets/AccentColor.colorset/Contents.json b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 000000000..eb8789700 --- /dev/null +++ b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Assets.xcassets/AppIcon.appiconset/Contents.json b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..ffdfe150b --- /dev/null +++ b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,85 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "tinted" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Assets.xcassets/Contents.json b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/ContentView.swift b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/ContentView.swift new file mode 100644 index 000000000..4b5705bac --- /dev/null +++ b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/ContentView.swift @@ -0,0 +1,28 @@ +// +// ContentView.swift +// TestBuildIssuesClient +// +// Created by Yiannis Josephides on 24/01/2025. +// + +import ExternalSDK +import SwiftUI + +struct ContentView: View { + var body: some View { + VStack(spacing: 16) { + Button("Track Event") { + MyExternalSDK.shared.track(event: "test") + } + Image(systemName: "globe") + .imageScale(.large) + .foregroundStyle(.tint) + Text("Hello, world!") + } + .padding() + } +} + +#Preview { + ContentView() +} diff --git a/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/ExternalSDKClient.entitlements b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/ExternalSDKClient.entitlements new file mode 100644 index 000000000..f2ef3ae02 --- /dev/null +++ b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/ExternalSDKClient.entitlements @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>com.apple.security.app-sandbox</key> + <true/> + <key>com.apple.security.files.user-selected.read-only</key> + <true/> +</dict> +</plist> diff --git a/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/ExternalSDKClientApp.swift b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/ExternalSDKClientApp.swift new file mode 100644 index 000000000..c05111474 --- /dev/null +++ b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/ExternalSDKClientApp.swift @@ -0,0 +1,17 @@ +// +// ExternalSDKClientApp.swift +// TestBuildIssuesClient +// +// Created by Yiannis Josephides on 24/01/2025. +// + +import SwiftUI + +@main +struct TestBuildIssuesClientApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Preview Content/Preview Assets.xcassets/Contents.json b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/PostHogExampleExternalSDK/SDKClient/ExternalSDKClient/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PostHogExampleExternalSDK/SDKClient/PostHogExampleExternalSDKClient.xcodeproj/project.pbxproj b/PostHogExampleExternalSDK/SDKClient/PostHogExampleExternalSDKClient.xcodeproj/project.pbxproj new file mode 100644 index 000000000..6cb4f3609 --- /dev/null +++ b/PostHogExampleExternalSDK/SDKClient/PostHogExampleExternalSDKClient.xcodeproj/project.pbxproj @@ -0,0 +1,379 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + DA2A5E2A2D43DAA100FE7CF4 /* ExternalSDK in Frameworks */ = {isa = PBXBuildFile; productRef = DA2A5E292D43DAA100FE7CF4 /* ExternalSDK */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + DA0AC72F2D43B22300214AB3 /* ExternalSDK.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = ExternalSDK.xcframework; path = ../build/bin/ExternalSDK.xcframework; sourceTree = "<group>"; }; + DAA5EE4E2D43757A00D437E0 /* ExternalSDKClient.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ExternalSDKClient.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + DAA5EE502D43757A00D437E0 /* ExternalSDKClient */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = ExternalSDKClient; + sourceTree = "<group>"; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + DAA5EE4B2D43757A00D437E0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + DA2A5E2A2D43DAA100FE7CF4 /* ExternalSDK in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + DAA5EE452D43757A00D437E0 = { + isa = PBXGroup; + children = ( + DAA5EE502D43757A00D437E0 /* ExternalSDKClient */, + DAA5EE602D4376A200D437E0 /* Frameworks */, + DAA5EE4F2D43757A00D437E0 /* Products */, + ); + sourceTree = "<group>"; + }; + DAA5EE4F2D43757A00D437E0 /* Products */ = { + isa = PBXGroup; + children = ( + DAA5EE4E2D43757A00D437E0 /* ExternalSDKClient.app */, + ); + name = Products; + sourceTree = "<group>"; + }; + DAA5EE602D4376A200D437E0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + DA0AC72F2D43B22300214AB3 /* ExternalSDK.xcframework */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + DAA5EE4D2D43757A00D437E0 /* ExternalSDKClient */ = { + isa = PBXNativeTarget; + buildConfigurationList = DAA5EE5D2D43757B00D437E0 /* Build configuration list for PBXNativeTarget "ExternalSDKClient" */; + buildPhases = ( + DAA5EE4A2D43757A00D437E0 /* Sources */, + DAA5EE4B2D43757A00D437E0 /* Frameworks */, + DAA5EE4C2D43757A00D437E0 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + DAA5EE502D43757A00D437E0 /* ExternalSDKClient */, + ); + name = ExternalSDKClient; + packageProductDependencies = ( + DA2A5E292D43DAA100FE7CF4 /* ExternalSDK */, + ); + productName = TestBuildIssuesClient; + productReference = DAA5EE4E2D43757A00D437E0 /* ExternalSDKClient.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + DAA5EE462D43757A00D437E0 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1620; + LastUpgradeCheck = 1620; + TargetAttributes = { + DAA5EE4D2D43757A00D437E0 = { + CreatedOnToolsVersion = 16.2; + }; + }; + }; + buildConfigurationList = DAA5EE492D43757A00D437E0 /* Build configuration list for PBXProject "PostHogExampleExternalSDKClient" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = DAA5EE452D43757A00D437E0; + minimizedProjectReferenceProxies = 1; + packageReferences = ( + DA2A5E282D43DAA100FE7CF4 /* XCLocalSwiftPackageReference "../../PostHogExampleExternalSDK" */, + ); + preferredProjectObjectVersion = 77; + productRefGroup = DAA5EE4F2D43757A00D437E0 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + DAA5EE4D2D43757A00D437E0 /* ExternalSDKClient */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + DAA5EE4C2D43757A00D437E0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + DAA5EE4A2D43757A00D437E0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + DAA5EE5B2D43757B00D437E0 /* 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 = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + DAA5EE5C2D43757B00D437E0 /* 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 = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SWIFT_COMPILATION_MODE = wholemodule; + }; + name = Release; + }; + DAA5EE5E2D43757B00D437E0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = ExternalSDKClient/ExternalSDKClient.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"ExternalSDKClient/Preview Content\""; + DEVELOPMENT_TEAM = ""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 15.1; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.posthog.example.ExampleSDKClient; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,7"; + XROS_DEPLOYMENT_TARGET = 2.2; + }; + name = Debug; + }; + DAA5EE5F2D43757B00D437E0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = ExternalSDKClient/ExternalSDKClient.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"ExternalSDKClient/Preview Content\""; + DEVELOPMENT_TEAM = ""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 15.1; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.posthog.example.ExampleSDKClient; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,7"; + XROS_DEPLOYMENT_TARGET = 2.2; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + DAA5EE492D43757A00D437E0 /* Build configuration list for PBXProject "PostHogExampleExternalSDKClient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DAA5EE5B2D43757B00D437E0 /* Debug */, + DAA5EE5C2D43757B00D437E0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DAA5EE5D2D43757B00D437E0 /* Build configuration list for PBXNativeTarget "ExternalSDKClient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DAA5EE5E2D43757B00D437E0 /* Debug */, + DAA5EE5F2D43757B00D437E0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + DA2A5E282D43DAA100FE7CF4 /* XCLocalSwiftPackageReference "../../PostHogExampleExternalSDK" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = ../../PostHogExampleExternalSDK; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + DA2A5E292D43DAA100FE7CF4 /* ExternalSDK */ = { + isa = XCSwiftPackageProductDependency; + productName = ExternalSDK; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = DAA5EE462D43757A00D437E0 /* Project object */; +} diff --git a/PostHogExampleExternalSDK/Sources/ExternalSDK-iOS/ExternalSDK-iOS.swift b/PostHogExampleExternalSDK/Sources/ExternalSDK-iOS/ExternalSDK-iOS.swift new file mode 100644 index 000000000..9f58fae8e --- /dev/null +++ b/PostHogExampleExternalSDK/Sources/ExternalSDK-iOS/ExternalSDK-iOS.swift @@ -0,0 +1 @@ +// wrapper diff --git a/PostHogExampleExternalSDK/build_xcframework.sh b/PostHogExampleExternalSDK/build_xcframework.sh new file mode 100755 index 000000000..44a324693 --- /dev/null +++ b/PostHogExampleExternalSDK/build_xcframework.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# Get the directory where the script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Define output directories relative to script location +OUTPUT_DIR="$SCRIPT_DIR/build" +ARCHIVE_DIR="$OUTPUT_DIR/archives" +PROJECT_PATH="$SCRIPT_DIR/PostHogExampleExternalSDK.xcodeproj" + +rm -rf "$OUTPUT_DIR" +rm -rf "$ARCHIVE_DIR" +mkdir -p "$OUTPUT_DIR" +mkdir -p "$ARCHIVE_DIR" + +echo "Building for iOS devices..." +if ! xcodebuild archive \ + SKIP_INSTALL=NO \ + BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ + ENABLE_MODULE_VERIFIER=YES \ + -project "$PROJECT_PATH" \ + -scheme ExternalSDK \ + -configuration Release \ + -destination "generic/platform=iOS" \ + -archivePath "$ARCHIVE_DIR/ExternalSDK-iOS.xcarchive" | xcpretty; then + echo "Error: Failed to build framework for iOS Device" +fi + +echo "Building for iOS simulator..." +if ! xcodebuild archive \ + SKIP_INSTALL=NO \ + BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ + ENABLE_MODULE_VERIFIER=YES \ + -project "$PROJECT_PATH" \ + -scheme ExternalSDK \ + -configuration Release \ + -destination "generic/platform=iOS Simulator" \ + -archivePath "$ARCHIVE_DIR/ExternalSDK-iOS_Simulator.xcarchive" | xcpretty; then + echo "Error: Failed to build framework for iOS Simulator" +fi + +echo "Creating XCFramework..." +if ! xcodebuild -create-xcframework \ + -archive "$ARCHIVE_DIR/ExternalSDK-iOS.xcarchive" -framework ExternalSDK.framework \ + -archive "$ARCHIVE_DIR/ExternalSDK-iOS_Simulator.xcarchive" -framework ExternalSDK.framework \ + -output "$OUTPUT_DIR/bin/ExternalSDK.xcframework" | xcpretty; then + echo "Error: Failed to create XCFramework" + exit 1 +fi + +echo "XCFramework created at $OUTPUT_DIR/bin/ExternalSDK.xcframework" \ No newline at end of file