Skip to content

Commit a8afc2b

Browse files
authored
Substrata updates (#21)
* Added tvOS support & CI setup.
1 parent f898205 commit a8afc2b

File tree

9 files changed

+117
-18
lines changed

9 files changed

+117
-18
lines changed

.github/.DS_Store

6 KB
Binary file not shown.

.github/workflows/swift.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Swift
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
cancel_previous:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: styfle/cancel-workflow-action@0.12.0
14+
with:
15+
workflow_id: ${{ github.event.workflow.id }}
16+
17+
generate_code_coverage:
18+
needs: cancel_previous
19+
runs-on: macos-15
20+
steps:
21+
- uses: maxim-lobanov/setup-xcode@v1
22+
with:
23+
xcode-version: "16.2"
24+
- uses: actions/checkout@v2
25+
- name: Build & Run tests
26+
run: swift test --enable-code-coverage
27+
- name: Convert coverage report
28+
run: xcrun llvm-cov export -format="lcov" .build/debug/AnalyticsLivePackageTests.xctest/Contents/MacOS/AnalyticsLivePackageTests -instr-profile .build/debug/codecov/default.profdata > coverage.lcov
29+
- name: Upload coverage reports to Codecov
30+
uses: codecov/codecov-action@v4.0.1
31+
with:
32+
token: ${{ secrets.CODECOV_TOKEN }}
33+
slug: segment-integrations/analytics-swift-live
34+
35+
build_and_test_spm_mac:
36+
needs: cancel_previous
37+
runs-on: macos-15
38+
steps:
39+
- uses: maxim-lobanov/setup-xcode@v1
40+
with:
41+
xcode-version: "16.2"
42+
- uses: actions/checkout@v2
43+
- name: Build & Run tests
44+
run: swift test
45+
46+
build_and_test_ios:
47+
needs: cancel_previous
48+
runs-on: macos-15
49+
steps:
50+
- name: Install yeetd
51+
run: |
52+
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg
53+
sudo installer -pkg yeetd-normal.pkg -target /
54+
yeetd &
55+
- uses: maxim-lobanov/setup-xcode@v1
56+
with:
57+
xcode-version: "16.2"
58+
- uses: actions/checkout@v2
59+
- run: xcodebuild -scheme AnalyticsLive test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 16'
60+
61+
build_and_test_tvos:
62+
needs: cancel_previous
63+
runs-on: macos-15
64+
steps:
65+
- uses: maxim-lobanov/setup-xcode@v1
66+
with:
67+
xcode-version: "16.2"
68+
- uses: actions/checkout@v2
69+
- run: xcodebuild -scheme AnalyticsLive test -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV'

Package.resolved

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,28 @@ import PackageDescription
66
let package = Package(
77
name: "AnalyticsLive",
88
platforms: [
9-
.macOS("10.15"),
10-
.iOS("13.0"),
11-
//.tvOS("13.0"),
12-
//.watchOS("7.1")
9+
.macOS("10.15"),
10+
.iOS("13.0"),
11+
.tvOS("13.0"),
12+
//.watchOS("7.1")
1313
],
1414
products: [
1515
// Products define the executables and libraries a package produces, making them visible to other packages.
1616
.library(
1717
name: "AnalyticsLive",
18-
targets: ["AnalyticsLive"]),
18+
targets: ["AnalyticsLive"])
1919
],
2020
dependencies: [
21-
// Dependencies declare other packages that this package depends on.
22-
.package(url: "https://github.com/segmentio/analytics-swift.git", from: "1.6.2"),
23-
//.package(path: "../analytics-swift"),
24-
.package(url: "https://github.com/segmentio/substrata-swift.git", from: "2.0.8")
21+
.package(url: "https://github.com/segmentio/analytics-swift.git", from: "1.7.2"),
22+
.package(url: "https://github.com/segmentio/substrata-swift.git", from: "2.0.9"),
2523
],
2624
targets: [
27-
// Targets are the basic building blocks of a package, defining a module or a test suite.
28-
// Targets can depend on other targets in this package and products from dependencies.
2925
.target(
3026
name: "AnalyticsLive",
3127
dependencies: [
3228
.product(name: "Segment", package: "analytics-swift"),
3329
.product(name: "Substrata", package: "substrata-swift"),
34-
.product(name: "SubstrataQuickJS", package: "substrata-swift")
30+
.product(name: "SubstrataQuickJS", package: "substrata-swift"),
3531
]),
3632
.testTarget(
3733
name: "AnalyticsLiveTests",

Sources/AnalyticsLive/Signals/AutoTracking/SwiftUI/SignalSecureField.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public struct SignalSecureField<Label>: SignalingUI, View where Label: View {
1515
let signalPrompt: Any?
1616

1717
public var body: some View {
18-
if #available(iOS 15, macOS 12.0, *) {
18+
if #available(iOS 15, macOS 12.0, tvOS 15.0, *) {
1919
return sui.modifier(SignalFocused(signalLabel: nil, signalTitle: signalTitle, signalPrompt: signalPrompt, component: Self.controlType()))
2020
} else {
2121
return sui

Sources/AnalyticsLive/Signals/AutoTracking/SwiftUI/SignalSlider.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// Created by Brandon Sneed on 2/3/25.
66
//
77

8+
#if !os(tvOS)
9+
810
import SwiftUI
911

1012
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
@@ -196,3 +198,5 @@ extension SignalSlider where Label == Text, ValueLabel == EmptyView {
196198
self.signalLabel = String(title)
197199
}
198200
}
201+
202+
#endif

Sources/AnalyticsLive/Signals/AutoTracking/SwiftUI/SignalStepper.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// Created by Brandon Sneed on 2/3/25.
66
//
77

8+
#if !os(tvOS)
9+
810
import SwiftUI
911

1012
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
@@ -177,3 +179,5 @@ extension SignalStepper where Label == Text {
177179
self.signalLabel = String(title)
178180
}
179181
}
182+
183+
#endif

Sources/AnalyticsLive/Signals/AutoTracking/SwiftUI/Typealiases.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Foundation
1313

1414
// Navigation
1515
typealias NavigationLink = SignalNavigationLink
16-
@available(iOS 16.0, macOS 13.0, *)
16+
@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
1717
typealias NavigationStack = SignalNavigationStack
1818

1919
// Selection & Input Controls
@@ -22,4 +22,7 @@ typealias TextField = SignalTextField
2222
typealias SecureField = SignalSecureField
2323
typealias Picker = SignalPicker
2424
typealias Toggle = SignalToggle
25+
#if !os(tvOS)
2526
typealias Slider = SignalSlider
27+
typealias Stepper = SignalStepper
28+
#endif

codecov.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
ignore:
2+
- "Tests" # ignore all tests
3+
4+
coverage:
5+
status:
6+
project:
7+
default:
8+
target: 50%
9+
threshold: 5%
10+
informational: false
11+
patch:
12+
default:
13+
target: 80%
14+
informational: false
15+
16+
comment:
17+
layout: "diff, flags, files"
18+
behavior: default
19+
require_changes: false # learn more in the Requiring Changes section below
20+
require_base: false # [true :: must have a base report to post]
21+
require_head: true # [true :: must have a head report to post]
22+
hide_project_coverage: false # [true :: only show coverage on the git diff]
23+

0 commit comments

Comments
 (0)