Skip to content

Bump to Swift 6.1 toolchain #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 23, 2025
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/compatibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
include:
- os: macos-15
xcode-version: "16.0" # Swift 6.0
xcode-version: "16.3" # Swift 6.1
runs-on: ${{ matrix.os }}
env:
OPENGRAPH_WERROR: 1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-15]
xcode-version: ["16.0"] # Swift 6.0
xcode-version: ["16.3"] # Swift 6.1
ios-version: ["18.0"]
include:
- ios-version: "18.0"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-15]
xcode-version: ["16.0"] # Swift 6.0
xcode-version: ["16.3"] # Swift 6.1
runs-on: ${{ matrix.os }}
env:
OPENGRAPH_WERROR: 1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
swift_version: ["6.0"]
swift_version: ["6.1"]
runs-on: ubuntu-22.04
env:
OPENGRAPH_WERROR: 1
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved

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

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 6.0
// swift-tools-version: 6.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import Foundation
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ The project is for the following purposes:

Currently, this project is in early development.

## Build

The current suggested toolchain to build the project is Swift 6.1 / Xcode 16.3.

## Credits

OpenGraph_SPI's Data, Graph, Vector and more is modified based on [Compute](https://github.com/jcmosc/Compute)'s implementations.
Expand Down
6 changes: 5 additions & 1 deletion Sources/OpenGraph_SPI/include/OGBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@
#define OG_CONSTEXPR
#endif

#if __has_include(<ptrcheck.h>) // Fix conflict define issue of the SDK
#include <ptrcheck.h>
#define OG_COUNTED_BY(N) __counted_by(N)
#else
#if !defined(__counted_by)
#if __has_attribute(__counted_by__)
#define __counted_by(N) __attribute__((__counted_by__(N)))
#else
#define __counted_by(N)
#endif
#endif

#define OG_COUNTED_BY(N) __counted_by(N)
#endif

#include "OGSwiftSupport.h"
#include "OGTargetConditionals.h"
Expand Down
9 changes: 9 additions & 0 deletions Sources/OpenGraph_SPI/include/OGGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,18 @@ OG_EXPORT
OG_REFINED_FOR_SWIFT
void OGGraphSetNeedsUpdate(OGGraphRef graph) OG_SWIFT_NAME(OGGraphRef.setNeedsUpdate(self:));

#if OG_TARGET_OS_DARWIN
OG_EXPORT
OG_REFINED_FOR_SWIFT
bool OGGraphAnyInputsChanged(const OGAttribute *inputs OG_COUNTED_BY(count), size_t count);
#else
// __counted_by__ is supported with Swift 6.1+ toolchain's clang on Linux.
// But it required the count to be declared first which is not required on Apple clang.
// See https://github.com/OpenSwiftUIProject/OpenGraph/issues/130
OG_EXPORT
OG_REFINED_FOR_SWIFT
bool OGGraphAnyInputsChanged(const OGAttribute *inputs, size_t count);
#endif

OG_EXTERN_C_END

Expand Down