Skip to content

Commit

Permalink
add support
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto committed Nov 2, 2023
1 parent ff9b814 commit 3cb77c9
Show file tree
Hide file tree
Showing 13 changed files with 714 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PackageDescription
let package = Package(
name: "PostHog",
platforms: [
.macOS(.v10_14), .iOS(.v13), .tvOS(.v13),
.macOS(.v10_14), .iOS(.v13), .tvOS(.v13), .watchOS(.v6),
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
Expand Down
1 change: 1 addition & 0 deletions PostHog.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '13.0'
s.tvos.deployment_target = '13.0'
s.osx.deployment_target = "10.14"
s.watchos.deployment_target = "6.0"
s.swift_versions = "5.3"

s.frameworks = 'Foundation'
Expand Down
53 changes: 49 additions & 4 deletions PostHog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,20 @@
remoteGlobalIDString = 690FF0422AE7DB3600A0B06B;
remoteInfo = PostHogExampleWithSPM;
};
690FF1782AF3CE8B00A0B06B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 690FF1732AF3CE8A00A0B06B /* PostHogExampleWatchOS.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 690FF1562AF3CE8900A0B06B;
remoteInfo = PostHogExampleWatchOS;
};
690FF17A2AF3CE8B00A0B06B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 690FF1732AF3CE8A00A0B06B /* PostHogExampleWatchOS.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 690FF15C2AF3CE8900A0B06B;
remoteInfo = "PostHogExampleWatchOS Watch App";
};
69278D4D2AE6BC9000BB541A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 3AC745AC296D6FE60025C109 /* Project object */;
Expand Down Expand Up @@ -181,6 +195,7 @@
690FF0E22AEFD12900A0B06B /* PostHogConfigTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogConfigTest.swift; sourceTree = "<group>"; };
690FF0E82AEFD3BD00A0B06B /* PostHogQueueTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogQueueTest.swift; sourceTree = "<group>"; };
690FF0F42AF0F06100A0B06B /* PostHogSDKTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogSDKTest.swift; sourceTree = "<group>"; };
690FF1732AF3CE8A00A0B06B /* PostHogExampleWatchOS.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PostHogExampleWatchOS.xcodeproj; path = PostHogExampleWatchOS/PostHogExampleWatchOS.xcodeproj; sourceTree = "<group>"; };
69261D122AD5685B00232EC7 /* PostHogFeatureFlags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogFeatureFlags.swift; sourceTree = "<group>"; };
69261D182AD9673500232EC7 /* PostHogBatchUploadInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogBatchUploadInfo.swift; sourceTree = "<group>"; };
69261D1A2AD9678C00232EC7 /* PostHogEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogEvent.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -301,6 +316,7 @@
3AC745AB296D6FE60025C109 = {
isa = PBXGroup;
children = (
690FF1732AF3CE8A00A0B06B /* PostHogExampleWatchOS.xcodeproj */,
690FF0532AE7DB3700A0B06B /* PostHogExampleWithSPM.xcodeproj */,
690FF02F2AE7C5BA00A0B06B /* PostHogExampleWithPods.xcodeproj */,
3AAFB13129C0C699004F485B /* Package.swift */,
Expand Down Expand Up @@ -382,6 +398,15 @@
name = Products;
sourceTree = "<group>";
};
690FF1742AF3CE8A00A0B06B /* Products */ = {
isa = PBXGroup;
children = (
690FF1792AF3CE8B00A0B06B /* PostHogExampleWatchOS.app */,
690FF17B2AF3CE8B00A0B06B /* PostHogExampleWatchOS Watch App.app */,
);
name = Products;
sourceTree = "<group>";
};
69261D152AD92D6C00232EC7 /* Frameworks */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -556,6 +581,10 @@
productRefGroup = 3AC745B6296D6FE60025C109 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 690FF1742AF3CE8A00A0B06B /* Products */;
ProjectRef = 690FF1732AF3CE8A00A0B06B /* PostHogExampleWatchOS.xcodeproj */;
},
{
ProductGroup = 690FF0302AE7C5BA00A0B06B /* Products */;
ProjectRef = 690FF02F2AE7C5BA00A0B06B /* PostHogExampleWithPods.xcodeproj */;
Expand Down Expand Up @@ -590,6 +619,20 @@
remoteRef = 690FF0572AE7DB3700A0B06B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
690FF1792AF3CE8B00A0B06B /* PostHogExampleWatchOS.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = PostHogExampleWatchOS.app;
remoteRef = 690FF1782AF3CE8B00A0B06B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
690FF17B2AF3CE8B00A0B06B /* PostHogExampleWatchOS Watch App.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = "PostHogExampleWatchOS Watch App.app";
remoteRef = 690FF17A2AF3CE8B00A0B06B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
Expand Down Expand Up @@ -958,15 +1001,16 @@
PRODUCT_BUNDLE_IDENTIFIER = com.posthog.PostHog;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 13.0;
WATCHOS_DEPLOYMENT_TARGET = 6.0;
};
name = Debug;
};
Expand Down Expand Up @@ -1000,14 +1044,15 @@
PRODUCT_BUNDLE_IDENTIFIER = com.posthog.PostHog;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 13.0;
WATCHOS_DEPLOYMENT_TARGET = 6.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "690FF15B2AF3CE8900A0B06B"
BuildableName = "PostHogExampleWatchOS Watch App.app"
BlueprintName = "PostHogExampleWatchOS Watch App"
ReferencedContainer = "container:PostHogExampleWatchOS/PostHogExampleWatchOS.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "690FF1552AF3CE8900A0B06B"
BuildableName = "PostHogExampleWatchOS.app"
BlueprintName = "PostHogExampleWatchOS"
ReferencedContainer = "container:PostHogExampleWatchOS/PostHogExampleWatchOS.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">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "690FF15B2AF3CE8900A0B06B"
BuildableName = "PostHogExampleWatchOS Watch App.app"
BlueprintName = "PostHogExampleWatchOS Watch App"
ReferencedContainer = "container:PostHogExampleWatchOS/PostHogExampleWatchOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "690FF15B2AF3CE8900A0B06B"
BuildableName = "PostHogExampleWatchOS Watch App.app"
BlueprintName = "PostHogExampleWatchOS Watch App"
ReferencedContainer = "container:PostHogExampleWatchOS/PostHogExampleWatchOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
BlueprintIdentifier = "690FF01D2AE7C5B900A0B06B"
BuildableName = "PostHogExampleWithPods.app"
BlueprintName = "PostHogExampleWithPods"
ReferencedContainer = "container:PostHogExampleWithPods.xcodeproj">
ReferencedContainer = "container:PostHogExampleWithPods/PostHogExampleWithPods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
Expand Down Expand Up @@ -46,7 +46,7 @@
BlueprintIdentifier = "690FF01D2AE7C5B900A0B06B"
BuildableName = "PostHogExampleWithPods.app"
BlueprintName = "PostHogExampleWithPods"
ReferencedContainer = "container:PostHogExampleWithPods.xcodeproj">
ReferencedContainer = "container:PostHogExampleWithPods/PostHogExampleWithPods.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
Expand All @@ -63,7 +63,7 @@
BlueprintIdentifier = "690FF01D2AE7C5B900A0B06B"
BuildableName = "PostHogExampleWithPods.app"
BlueprintName = "PostHogExampleWithPods"
ReferencedContainer = "container:PostHogExampleWithPods.xcodeproj">
ReferencedContainer = "container:PostHogExampleWithPods/PostHogExampleWithPods.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
BlueprintIdentifier = "690FF0412AE7DB3600A0B06B"
BuildableName = "PostHogExampleWithSPM.app"
BlueprintName = "PostHogExampleWithSPM"
ReferencedContainer = "container:PostHogExampleWithSPM.xcodeproj">
ReferencedContainer = "container:PostHogExampleWithSPM/PostHogExampleWithSPM.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
Expand Down Expand Up @@ -46,7 +46,7 @@
BlueprintIdentifier = "690FF0412AE7DB3600A0B06B"
BuildableName = "PostHogExampleWithSPM.app"
BlueprintName = "PostHogExampleWithSPM"
ReferencedContainer = "container:PostHogExampleWithSPM.xcodeproj">
ReferencedContainer = "container:PostHogExampleWithSPM/PostHogExampleWithSPM.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
Expand All @@ -63,7 +63,7 @@
BlueprintIdentifier = "690FF0412AE7DB3600A0B06B"
BuildableName = "PostHogExampleWithSPM.app"
BlueprintName = "PostHogExampleWithSPM"
ReferencedContainer = "container:PostHogExampleWithSPM.xcodeproj">
ReferencedContainer = "container:PostHogExampleWithSPM/PostHogExampleWithSPM.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "watchos",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// ContentView.swift
// PostHogExampleWatchOS Watch App
//
// Created by Manoel Aranda Neto on 02.11.23.
//

import SwiftUI

struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.padding()
}
}

#Preview {
ContentView()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// PostHogExampleWatchOSApp.swift
// PostHogExampleWatchOS Watch App
//
// Created by Manoel Aranda Neto on 02.11.23.
//

import PostHog
import SwiftUI

@main
struct PostHogExampleWatchOS_Watch_AppApp: App {
init() {
// TODO: init on app delegate instead
let config = PostHogConfig(
apiKey: "_6SG-F7I1vCuZ-HdJL3VZQqjBlaSb1_20hDPwqMNnGI"
)

PostHogSDK.shared.setup(config)
PostHogSDK.shared.debug()
PostHogSDK.shared.capture("Event from WatchOS example!")
}

var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading

0 comments on commit 3cb77c9

Please sign in to comment.