Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Saurav/update to upstream #1

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6bc0ed5
Initial state is attempting to be accessed prior to completion. (#289)
alanjcharles Jan 11, 2024
51f56b9
Version 1.5.2
alanjcharles Jan 11, 2024
3c49330
Multiple instance write key (#294)
alanjcharles Feb 12, 2024
70490c9
Address thread-safety of SCNetworkReachability (#295)
bsneed Feb 12, 2024
28ab076
Update README.md
alanjcharles Feb 13, 2024
35b6ec8
fix: add check to drop events that return a 400 response from Segment…
alanjcharles Feb 13, 2024
067d089
Version 1.5.3
alanjcharles Feb 13, 2024
4b171a3
update sovran to include thread safety (#298)
alanjcharles Feb 26, 2024
be838a5
Version 1.5.4
alanjcharles Feb 26, 2024
c75efbd
Fixup b5d5fa9 (#299)
junpluse Feb 27, 2024
33f07bd
Version 1.5.5
alanjcharles Feb 27, 2024
813b657
Allow Codable compliant values in json's init(any). (#302)
bsneed Feb 28, 2024
6f60c90
Add convenience access to the writekey in use. (#303)
bsneed Mar 4, 2024
40ec9ac
fix: remove unnecessary settings var and update in destinationMetaDat…
alanjcharles Mar 8, 2024
7c9c162
Storage Additions & Refactoring (#304)
bsneed Mar 8, 2024
da06eb0
Updated access levels on storage classes. (#306)
bsneed Mar 11, 2024
c3909ca
Updated storage directory selection logic (#307)
bsneed Mar 11, 2024
a59b6fe
Version 1.5.6
alanjcharles Mar 18, 2024
63137cd
UserAgent fix (#313)
bsneed Mar 19, 2024
718a26a
Version 1.5.7
bsneed Mar 19, 2024
fa5bc72
fix apiHost comparison SegmentDestination.swift (#314)
pietropizzi Mar 21, 2024
39529e8
Process PrivacyInfo.xcprivacy as resource instead of excluding it (#310)
FelixHerrmann Mar 22, 2024
18b0cde
[Fix] Missing Privacy Tracking and API-Types (#311)
FelixHerrmann Mar 22, 2024
c181b75
Updated privacy info (#315)
bsneed Mar 22, 2024
1da1a3d
Version 1.5.8
bsneed Mar 22, 2024
377f04d
Remove privacy domains (fixes #315) (#318)
bsneed Mar 27, 2024
7eeb2ab
Version 1.5.9
bsneed Mar 27, 2024
72415f4
docs: add apple doc for track apis (#319)
jamesonwilliams Apr 2, 2024
d43c7a8
Add ability to control anonymousId values. (#327)
bsneed Apr 17, 2024
01d39d2
Refactored operatingMode related code. (#328)
bsneed Apr 18, 2024
8145e9e
Renamed JSONSafeEncoder to JSONSafeEncoding (#329)
bsneed Apr 19, 2024
4a744ef
Fix memory leak when processing locally stored events (#334)
eofs Apr 23, 2024
a1b519e
Moved JSONSafeEncoding to v2.0 (#335)
bsneed Apr 23, 2024
89014de
fix: Atomic increment is now performed within one enqueued operation …
TizianoCoroneo Apr 23, 2024
13ad034
Fixed self reference in IDFA example.
bsneed Apr 23, 2024
51d2d93
Fixed test timing.
bsneed Apr 23, 2024
f6f3a7f
Version 1.5.11
bsneed Apr 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 98 additions & 77 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,119 +2,140 @@ name: Swift

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
cancel_previous:
runs-on: ubuntu-latest
steps:
- uses: styfle/cancel-workflow-action@0.9.1
with:
workflow_id: ${{ github.event.workflow.id }}
- uses: styfle/cancel-workflow-action@0.12.0
with:
workflow_id: ${{ github.event.workflow.id }}

build_and_test_spm_mac:
needs: cancel_previous
runs-on: macos-latest
runs-on: macos-14
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- name: Build
run: swift build
- name: Run tests
run: swift test
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "15.2"
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- name: Build
run: swift build
- name: Run tests
run: swift test

build_and_test_spm_linux:
needs: cancel_previous
runs-on: ubuntu-latest
steps:
- uses: fwal/setup-swift@v1.21.0
with:
swift-version: "5.7.2"
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- name: Build
run: swift build
- name: Run tests
run: swift test --enable-test-discovery
- uses: sersoft-gmbh/swifty-linux-action@v3
with:
release-version: "5.9.2"
github-token: ${{secrets.GITHUB_TOKEN}}
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- name: Build
run: swift build
- name: Run tests
run: swift test --enable-test-discovery

build_and_test_ios:
needs: cancel_previous
runs-on: macos-latest
runs-on: macos-14
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- run: xcodebuild -scheme Segment test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13'

- name: Install yeetd
run: |
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg
sudo installer -pkg yeetd-normal.pkg -target /
yeetd &
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "15.2"
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- run: xcodebuild -scheme Segment test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15'

build_and_test_tvos:
needs: cancel_previous
runs-on: macos-latest
runs-on: macos-14
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- run: xcodebuild -scheme Segment test -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV'
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "15.2"
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- run: xcodebuild -scheme Segment test -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV'

build_and_test_watchos:
needs: cancel_previous
runs-on: macos-latest
runs-on: macos-14
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "15.2"
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- run: xcodebuild -scheme Segment test -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)'

build_and_test_visionos:
needs: cancel_previous
runs-on: macos-14
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- run: xcodebuild -scheme Segment test -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm)'

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "15.2"
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- run: defaults write com.apple.dt.Xcode AllowUnsupportedVisionOSHost -bool YES
- run: defaults write com.apple.CoreSimulator AllowUnsupportedVisionOSHost -bool YES
- run: xcodebuild -downloadPlatform visionOS
- run: echo - skip until apple fixes this - xcodebuild -scheme Segment test -sdk xrsimulator -destination 'platform=visionOS Simulator,name=Apple Vision Pro'
- run: xcodebuild -scheme Segment -sdk xrsimulator -destination 'platform=visionOS Simulator,name=Apple Vision Pro'

build_and_test_examples:
needs: cancel_previous
runs-on: macos-latest
runs-on: macos-14
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- name: build for ios simulator
run: |
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "15.2"
- uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SOVRAN_SSH_KEY }}
- name: build for ios simulator
run: |
cd Examples/apps/BasicExample
xcodebuild -workspace "BasicExample.xcworkspace" -scheme "BasicExample" -sdk iphonesimulator
- name: build for ios simulator
run: |
- name: build for ios simulator
run: |
cd Examples/apps/ObjCExample
xcodebuild -workspace "ObjCExample.xcworkspace" -scheme "ObjCExample" -sdk iphonesimulator
- name: build for ios simulator
run: |
- name: build for ios simulator
run: |
cd Examples/apps/SegmentUIKitExample
xcodebuild -workspace "SegmentUIKitExample.xcworkspace" -scheme "SegmentUIKitExample" -sdk iphonesimulator
- name: build for ios simulator
run: |
- name: build for ios simulator
run: |
cd Examples/apps/SegmentWeatherWidget
xcodebuild -workspace "SegmentWeatherWidget.xcworkspace" -scheme "SegmentWeatherWidget" -sdk iphonesimulator
- name: build for mac catalyst
run: |
- name: build for mac catalyst
run: |
cd Examples/apps/SegmentUIKitExample
xcodebuild -workspace "SegmentUIKitExample.xcworkspace" -scheme "SegmentUIKitExample" -destination 'platform=macOS,variant=Mac Catalyst'

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down
14 changes: 10 additions & 4 deletions Examples/other_plugins/IDFACollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,16 @@ class IDFACollection: Plugin {
extension IDFACollection: iOSLifecycle {
func applicationDidBecomeActive(application: UIApplication?) {
let status = ATTrackingManager.trackingAuthorizationStatus
if status == .notDetermined && !alreadyAsked {
// we don't know, so should ask the user.
alreadyAsked = true
askForPermission()

_alreadyAsked.withValue { alreadyAsked in
if status == .notDetermined && !alreadyAsked {
// we don't know, so should ask the user.
alreadyAsked = true
DispatchQueue.main.async { [weak self] in
guard let self else { return }
askForPermission()
}
}
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.7
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -8,8 +8,9 @@ let package = Package(
platforms: [
.macOS("10.15"),
.iOS("13.0"),
.tvOS("11.0"),
.watchOS("7.1")
.tvOS("13.0"),
.watchOS("7.1"),
.visionOS("1.0")
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
Expand All @@ -20,8 +21,8 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/segmentio/sovran-swift.git", from: "1.1.0"),
.package(url: "https://github.com/segmentio/jsonsafeencoder-swift.git", from: "1.0.0")
.package(url: "https://github.com/segmentio/sovran-swift.git", from: "1.1.1"),
.package(url: "https://github.com/segmentio/jsonsafeencoding-swift.git", from: "2.0.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand All @@ -30,9 +31,9 @@ let package = Package(
name: "Segment",
dependencies: [
.product(name: "Sovran", package: "sovran-swift"),
.product(name: "JSONSafeEncoder", package: "jsonsafeencoder-swift")
.product(name: "JSONSafeEncoding", package: "jsonsafeencoding-swift")
],
exclude: ["PrivacyInfo.xcprivacy"]),
resources: [.process("Resources")]),
.testTarget(
name: "Segment-Tests",
dependencies: ["Segment"]),
Expand Down
41 changes: 0 additions & 41 deletions Package@swift-5.9.swift

This file was deleted.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
![](https://github.com/segmentio/analytics-swift/actions/workflows/swift.yml/badge.svg)
![](https://img.shields.io/github/license/segmentio/analytics-swift)

### 🎉 Flagship 🎉
This library is one of Segment’s most popular Flagship libraries. It is actively maintained by Segment, benefitting from new feature releases and ongoing support.

The hassle-free way to add Segment analytics to your Swift app (iOS/tvOS/visionOS/watchOS/macOS/Linux/iPadOS). Analytics helps you measure your users, product, and business. It unlocks insights into your app's funnel, core business metrics, and whether you have product-market fit.

## How to get started
Expand Down
Loading