Skip to content

Commit ae9fbe7

Browse files
feat: add watchOS and tvOS support to iOS SDK
1 parent b539f49 commit ae9fbe7

File tree

5 files changed

+89
-17
lines changed

5 files changed

+89
-17
lines changed

.github/workflows/ci.yaml

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,44 @@ name: CI
33
on:
44
pull_request:
55
branches:
6-
- 'main'
6+
- "main"
77
push:
88
branches:
9-
- 'main'
9+
- "main"
1010

1111
jobs:
1212
Tests:
1313
runs-on: macOS-latest
14+
strategy:
15+
matrix:
16+
platform: [iOS, macOS, watchOS, tvOS]
17+
include:
18+
- platform: iOS
19+
destination: "platform=iOS Simulator,name=iPhone 15"
20+
- platform: macOS
21+
destination: "platform=macOS"
22+
- platform: watchOS
23+
destination: "platform=watchOS Simulator,name=Apple Watch Series 10 (42mm)"
24+
- platform: tvOS
25+
destination: "platform=tvOS Simulator,name=Apple TV"
1426
steps:
15-
- uses: actions/checkout@v4
16-
- name: Build and Test
17-
run: swift test
27+
- uses: actions/checkout@v4
28+
- name: Build and Test on ${{ matrix.platform }}
29+
run: |
30+
if [ "${{ matrix.platform }}" = "macOS" ]; then
31+
swift test
32+
else
33+
xcodebuild test \
34+
-workspace .swiftpm/xcode/package.xcworkspace \
35+
-scheme OpenFeature \
36+
-destination "${{ matrix.destination }}"
37+
fi
1838
1939
SwiftLint:
2040
runs-on: ubuntu-latest
2141
steps:
22-
- uses: actions/checkout@v4
23-
- name: GitHub Action for SwiftLint
24-
uses: norio-nomura/[email protected]
25-
with:
26-
args: --config .swiftlint.yml
42+
- uses: actions/checkout@v4
43+
- name: GitHub Action for SwiftLint
44+
uses: norio-nomura/[email protected]
45+
with:
46+
args: --config .swiftlint.yml

OpenFeature.podspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Pod::Spec.new do |s|
33
s.version = '0.3.0'
44
s.summary = 'OpenFeature iOS SDK'
55
s.description = <<-DESC
6-
OpenFeature is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool or in-house solution.
6+
OpenFeature is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool or in-house solution. This Swift SDK supports iOS, macOS, watchOS, and tvOS.
77
DESC
88
s.homepage = 'https://github.com/open-feature/swift-sdk'
99
s.license = { :type => 'Apache-2.0', :file => 'LICENSE' }
@@ -12,6 +12,8 @@ OpenFeature is an open specification that provides a vendor-agnostic, community-
1212

1313
s.ios.deployment_target = '14.0'
1414
s.osx.deployment_target = '11.0'
15+
s.watchos.deployment_target = '7.0'
16+
s.tvos.deployment_target = '14.0'
1517
s.swift_version = '5.5'
1618

1719
s.source_files = 'Sources/OpenFeature/**/*'

Package.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ let package = Package(
88
platforms: [
99
.iOS(.v14),
1010
.macOS(.v11),
11+
.watchOS(.v7),
12+
.tvOS(.v14),
1113
],
1214
products: [
1315
.library(
1416
name: "OpenFeature",
15-
targets: ["OpenFeature"]),
16-
],
17-
dependencies: [
17+
targets: ["OpenFeature"])
1818
],
19+
dependencies: [],
1920
targets: [
2021
.target(
2122
name: "OpenFeature",

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@
3636

3737
### Requirements
3838

39-
- The minimum iOS version supported is: `iOS 14`.
39+
This SDK supports the following Apple platforms:
40+
- **iOS 14+**
41+
- **macOS 11+**
42+
- **watchOS 7+**
43+
- **tvOS 14+**
4044

41-
Note that this library is intended to be used in a mobile context, and has not been evaluated for use in other type of applications (e.g. server applications, macOS, tvOS, watchOS, etc.).
45+
The SDK is built with Swift 5.5+ and uses only Foundation and Combine frameworks, making it suitable for all Apple platform contexts including mobile, desktop, wearable, and TV applications.
4246

4347
### Install
4448

@@ -85,7 +89,7 @@ Then, run:
8589
pod install
8690
```
8791

88-
### Usage
92+
### iOS Usage
8993

9094
```swift
9195
import OpenFeature

scripts/validate-platforms.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# Script to validate that OpenFeature builds and runs on all Apple platforms
4+
5+
set -e
6+
7+
echo "🚀 Validating OpenFeature Swift SDK on all Apple platforms..."
8+
echo ""
9+
10+
# Function to run platform tests
11+
test_platform() {
12+
local platform=$1
13+
local destination=$2
14+
15+
echo "🧪 Testing $platform..."
16+
17+
if [ "$platform" = "macOS" ]; then
18+
swift test
19+
echo "$platform tests passed"
20+
else
21+
xcodebuild test -workspace .swiftpm/xcode/package.xcworkspace -scheme OpenFeature -destination "$destination"
22+
echo "$platform tests passed"
23+
fi
24+
}
25+
26+
# Test all platforms using specific working devices
27+
test_platform "macOS" "platform=macOS"
28+
echo ""
29+
30+
test_platform "iOS" "platform=iOS Simulator,name=iPhone 16"
31+
echo ""
32+
33+
test_platform "watchOS" "platform=watchOS Simulator,name=Apple Watch Series 10 (42mm)"
34+
echo ""
35+
36+
test_platform "tvOS" "platform=tvOS Simulator,name=Apple TV"
37+
echo ""
38+
39+
# Summary
40+
echo "📋 Platform configuration:"
41+
grep -A 10 "platforms:" Package.swift | head -6
42+
43+
echo ""
44+
echo "🎉 OpenFeature Swift SDK platform validation completed!"
45+
echo ""

0 commit comments

Comments
 (0)