Skip to content

Commit

Permalink
feat: Migrate to Swift 6 language mode
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyMAndersson committed Jan 10, 2025
1 parent f79c917 commit 2f76ba0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/TestSuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Swift ${{ matrix.swift }} on ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-24.04, ubuntu-22.04, macos-14, macos-15]
swift: ["6.0"]
runs-on: ${{ matrix.os }}
steps:
Expand Down
11 changes: 7 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
// swift-tools-version:5.9
// swift-tools-version:6.0

import PackageDescription

let package = Package(
name: "StatKit",
platforms: [
.macCatalyst(.v17),
.macOS(.v14),
.iOS(.v17),
.tvOS(.v17)
.tvOS(.v17),
.watchOS(.v10),
.visionOS(.v2)
],
products: [
.library(
Expand Down Expand Up @@ -36,7 +39,7 @@ let package = Package(
dependencies: ["StatKit"]
)
],
swiftLanguageVersions: [
.v5
swiftLanguageModes: [
.v6
]
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</p>

<p align="center">
<img src="https://img.shields.io/badge/swift-5.9-blueviolet.svg" />
<img src="https://img.shields.io/badge/swift-6.0-blueviolet.svg" />
<img src="https://img.shields.io/badge/swift pm-compatible-blueviolet.svg?style=flat" alt="Swift PM Compatible" />
</p>

Expand Down Expand Up @@ -113,7 +113,7 @@ let normalRandomVariables = normal.sample(10)
StatKit is documented using Swift-DocC, which means that the documentation pages can be built by Xcode and viewed in the Developer Documentation panel. Build it by clicking `Product > Build Documentation` or hitting `Shift + Ctrl + Cmd + D`.

## System Requirements
To use StatKit, make sure that your system has Swift 5.9 (or later) installed. If you’re using a Mac, also make sure that `xcode-select` points at an Xcode installation that includes a valid version of Swift and that you’re running macOS 14 or later.
To use StatKit, make sure that your system has Swift 6.0 (or later) installed. If you’re using a Mac, also make sure that `xcode-select` points at an Xcode installation that includes a valid version of Swift and that you’re running macOS 14 or later.

**IMPORTANT**
StatKit **does not** officially support any beta software, including beta versions of Xcode and macOS, or unreleased versions of Swift.
Expand Down
11 changes: 11 additions & 0 deletions Sources/StatKit/Protocols/ConvertibleToReal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ extension ConvertibleToReal where Self: BinaryFloatingPoint {
extension Double: ConvertibleToReal {}
extension Float: ConvertibleToReal {}

#if swift(>=5.4) && !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
@available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)
extension Float16: ConvertibleToReal {}
#endif

#if canImport(CoreGraphics)
import CoreGraphics
extension CGFloat: ConvertibleToReal {}
Expand All @@ -41,3 +46,9 @@ extension UInt8: ConvertibleToReal {}
extension UInt16: ConvertibleToReal {}
extension UInt32: ConvertibleToReal {}
extension UInt64: ConvertibleToReal {}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Int128: ConvertibleToReal {}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension UInt128: ConvertibleToReal {}

0 comments on commit 2f76ba0

Please sign in to comment.