Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
104 changes: 24 additions & 80 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
run: ./Scripts/check-version-consistency.sh

xcodebuild:
name: Build with xcodebuild on Xcode 16
runs-on: macos-15
name: Build with xcodebuild on Xcode 26
runs-on: macos-26
strategy:
matrix:
platforms: [
Expand All @@ -40,110 +40,87 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.4.app/Contents/Developer
- name: Download visionOS
if: matrix.platforms == 'generic/platform=visionos'
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Download Platform
if: matrix.platforms != 'platform=macOS'
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
PLATFORM=$(echo "${{ matrix.platforms }}" | sed 's|generic/platform=||')
sudo xcodebuild -downloadPlatform "$PLATFORM"
- name: Build Framework
run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme SafeDI-Package -destination ${{ matrix.platforms }}

spm-package-integration:
name: Build Package Integration on Xcode 16
runs-on: macos-15
name: Build Package Integration on Xcode 26
runs-on: macos-26
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Build Package Integration
run: xcrun swift build --package-path "Examples/Example Package Integration"

spm-prebuilt-package-integration:
name: Build Prebuilt Package Integration on Xcode 16
runs-on: macos-15
name: Build Prebuilt Package Integration on Xcode 26
runs-on: macos-26
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Build Package Integration
run: |
xcrun swift package --package-path Examples/ExamplePrebuiltPackageIntegration --allow-network-connections all --allow-writing-to-package-directory safedi-release-install
xcrun swift build --package-path Examples/ExamplePrebuiltPackageIntegration

spm-project-integration:
name: Build Project Integration on Xcode 16
runs-on: macos-15
name: Build Project Integration on Xcode 26
runs-on: macos-26
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Replace 'main' branch with the current branch
if: github.event.pull_request.head.repo.full_name == github.repository # Only do this if the branch is from our repo.
run: sed -i '' "s#branch = main;#branch = ${{ github.head_ref || github.ref_name }};#" "Examples/ExampleProjectIntegration/ExampleProjectIntegration.xcodeproj/project.pbxproj"
- name: Build Project Integration
run: pushd Examples/ExampleProjectIntegration; xcrun xcodebuild build -skipPackagePluginValidation -skipMacroValidation -scheme ExampleProjectIntegration; popd

spm-multi-project-integration:
name: Build Multi Project Integration on Xcode 16
runs-on: macos-15
name: Build Multi Project Integration on Xcode 26
runs-on: macos-26
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Replace 'main' branch with the current branch
if: github.event.pull_request.head.repo.full_name == github.repository # Only do this if the branch is from our repo.
run: sed -i '' "s#branch = main;#branch = ${{ github.head_ref || github.ref_name }};#" "Examples/ExampleMultiProjectIntegration/ExampleMultiProjectIntegration.xcodeproj/project.pbxproj"
- name: Build Project Integration
run: pushd Examples/ExampleMultiProjectIntegration; xcrun xcodebuild build -skipPackagePluginValidation -skipMacroValidation -scheme ExampleMultiProjectIntegration; popd

pod-project-integration:
name: Build CocoaPods Integration on Xcode 16
runs-on: macos-15
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.5'
bundler-cache: true
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.4.0.app/Contents/Developer
- name: Install Pod
run: bundle exec pod install --project-directory=Examples/ExampleCocoaPodsIntegration
- name: Download iOS
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform iOS -buildVersion 22F77
- name: Build CocoaPods Integration
run: xcrun xcodebuild build -scheme ExampleCocoaPodsIntegration -configuration Debug -workspace Examples/ExampleCocoaPodsIntegration/ExampleCocoaPodsIntegration.xcworkspace -destination 'platform=iOS Simulator,OS=18.5,name=iPad (10th generation)' # Explicitly test the Debug build. Our pod lint jobs are already testing the Release build.

spm:
name: Build and Test on Xcode 16
runs-on: macos-15
name: Build and Test on Xcode 26
runs-on: macos-26
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.3.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Build and Test Framework
run: |
for i in {1..5}; do # Run tests a few times to ensure code-gen is stable.
Expand All @@ -159,43 +136,10 @@ jobs:
verbose: true
os: macos

pod-lint:
name: Pod Lint
runs-on: macos-15
strategy:
matrix:
platforms: [
"ios",
"tvos",
"watchos",
"macos",
"visionos",
]
fail-fast: false
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.5'
bundler-cache: true
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.4.app/Contents/Developer
- name: Download Simulator
if: matrix.platforms != 'macos'
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform ${{ matrix.platforms }}
- name: Lint Podspec
run: bundle exec pod lib lint --verbose --fail-fast --swift-version=6.0 --platforms=${{ matrix.platforms }}

linux:
name: Build and Test on Linux
runs-on: ubuntu-latest
container: swift:6.1
container: swift:6.3
permissions:
contents: read
steps:
Expand Down Expand Up @@ -232,7 +176,7 @@ jobs:
lint-swift:
name: Lint Swift
runs-on: ubuntu-latest
container: swift:6.1
container: swift:6.3
permissions:
contents: read
steps:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: macOS-15
runs-on: macos-26
permissions:
security-events: write
packages: read
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.4.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand All @@ -57,7 +57,7 @@ jobs:

- if: matrix.language == 'swift'
run: |
sudo xcode-select --switch /Applications/Xcode_16.4.app/Contents/Developer
sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
xcrun swift build -c release
- name: Perform CodeQL Analysis
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
build-release-cli:
name: Build Release CLI
runs-on: macos-15
runs-on: macos-26
strategy:
matrix:
architecture: [
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Build SafeDITool
run: xcrun swift build -c release --product SafeDITool --arch ${{ matrix.architecture }}
- name: Give SafeDITool executable permissions
Expand Down
7 changes: 6 additions & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@
--storedvarattrs same-line
--hexgrouping none
--decimalgrouping 3
--trailing-commas always
--test-case-name-format standard-identifiers
--import-grouping access-control,alpha,testable-last

# rules
--enable isEmpty
--enable wrapEnumCases
--enable wrapMultilineStatementBraces
--disable consistentSwitchCaseSpacing
--disable blankLineAfterSwitchCase
--disable hoistTry
--disable docComments

# global
--swiftversion 6.0
--swiftversion 6.3
6 changes: 3 additions & 3 deletions CLI/Package.resolved

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

4 changes: 2 additions & 2 deletions CLI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let package = Package(
],
products: [],
dependencies: [
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.56.1"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.60.1"),
],
targets: []
targets: [],
)
2 changes: 1 addition & 1 deletion Documentation/Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ UIKit applications’ natural root is the `UIApplicationDelegate`-conforming app

## Example applications

We’ve tied everything together with an example multi-user notes application backed by SwiftUI. You can compile and run this code in [an example single-module Xcode project](../Examples/ExampleProjectIntegration). This same multi-user notes app also exists in [an example multi-module Xcode project](../Examples/ExampleMultiProjectIntegration), and also in [an example Xcode project using CocoaPods](../Examples/ExampleCocoaPodsIntegration). We have also created [an example multi-module `Package.swift` that integrates with SafeDI](../Examples/Example Package Integration).
We’ve tied everything together with an example multi-user notes application backed by SwiftUI. You can compile and run this code in [an example single-module Xcode project](../Examples/ExampleProjectIntegration). This same multi-user notes app also exists in [an example multi-module Xcode project](../Examples/ExampleMultiProjectIntegration). We have also created [an example multi-module `Package.swift` that integrates with SafeDI](../Examples/Example Package Integration).

## Under the hood

Expand Down
6 changes: 3 additions & 3 deletions Examples/Example Package Integration/Package.resolved

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

29 changes: 15 additions & 14 deletions Examples/Example Package Integration/Package.swift
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
// swift-tools-version: 6.0
// swift-tools-version: 6.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "ExamplePackageIntegration",
platforms: [
.macOS(.v10_15),
.iOS(.v13),
.tvOS(.v13),
.watchOS(.v6),
.macCatalyst(.v13),
.macOS(.v11),
.iOS(.v15),
.tvOS(.v15),
.watchOS(.v8),
.macCatalyst(.v15),
.visionOS(.v1),
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "ExamplePackageIntegration",
targets: ["RootModule"]
targets: ["RootModule"],
),
],
dependencies: [
Expand All @@ -39,7 +40,7 @@ let package = Package(
],
plugins: [
.plugin(name: "SafeDIGenerator", package: "SafeDI"),
]
],
),
.target(
name: "ChildAModule",
Expand All @@ -50,7 +51,7 @@ let package = Package(
],
swiftSettings: [
.swiftLanguageMode(.v6),
]
],
),
.target(
name: "ChildBModule",
Expand All @@ -61,7 +62,7 @@ let package = Package(
],
swiftSettings: [
.swiftLanguageMode(.v6),
]
],
),
.target(
name: "ChildCModule",
Expand All @@ -72,7 +73,7 @@ let package = Package(
],
swiftSettings: [
.swiftLanguageMode(.v6),
]
],
),
.target(
name: "GrandchildrenModule",
Expand All @@ -82,14 +83,14 @@ let package = Package(
],
swiftSettings: [
.swiftLanguageMode(.v6),
]
],
),
.target(
name: "SharedModule",
dependencies: ["SafeDI"],
swiftSettings: [
.swiftLanguageMode(.v6),
]
],
),
]
],
)
Loading
Loading