Skip to content

Commit b1aea93

Browse files
committed
feat: migrate to latest Swift 6.2 (#57)
1 parent bffa4a1 commit b1aea93

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
matrix:
99
swiftver:
10-
- swift:6.0
10+
- swift:6.2
1111
swiftos:
1212
- jammy
1313
container: ${{ format('{0}-{1}', matrix.swiftver, matrix.swiftos) }}

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.3
1+
// swift-tools-version:6.2
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ SwiftCasbin
22
====
33

44
[![CI](https://github.com/casbin/SwiftCasbin/actions/workflows/test.yml/badge.svg)](https://github.com/casbin/SwiftCasbin/actions/workflows/test.yml)
5-
![Swift 6.0](https://img.shields.io/badge/Swift-6.0-orange)
5+
![Swift 6.2](https://img.shields.io/badge/Swift-6.2-orange)
66
[![Release](https://img.shields.io/github/v/release/casbin/SwiftCasbin)](https://github.com/casbin/SwiftCasbin/releases)
77
![iOS](https://img.shields.io/badge/iOS-✓-blue)
88
![macOS](https://img.shields.io/badge/macOS-✓-blue)

Sources/Casbin/Adapter/FileAdapter+AsyncAwait.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import NIO
44
extension FileAdapter {
55

66
// Generic bridge from EventLoopFuture to async/await
7-
private func awaitFuture<T>(_ future: EventLoopFuture<T>) async throws -> T {
7+
private func awaitFuture<T: Sendable>(_ future: EventLoopFuture<T>) async throws -> T {
88
try await withCheckedThrowingContinuation { cont in
99
future.whenComplete { result in
1010
cont.resume(with: result)

Sources/Casbin/Enforcer+AsyncAwait.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import NIO
44
extension Enforcer {
55

66
// Generic bridge from EventLoopFuture to async/await
7-
private func awaitFuture<T>(_ future: EventLoopFuture<T>) async throws -> T {
7+
private func awaitFuture<T: Sendable>(_ future: EventLoopFuture<T>) async throws -> T {
88
try await withCheckedThrowingContinuation { cont in
99
future.whenComplete { result in
1010
cont.resume(with: result)

Sources/Casbin/Enforcer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public enum EventLoopGroupProvider {
2323
case shared(EventLoopGroup)
2424
case createNew
2525
}
26-
public final class Enforcer {
26+
public final class Enforcer: @unchecked Sendable {
2727
public var storage: Storage
2828
public var logger: Logger
2929
public var model:Model

Tests/CasbinTests/ConfigTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import NIO
66
struct ConfigTests {
77
@Test("load from file and get/set")
88
func testGet() throws {
9-
let filePath = #file.components(separatedBy: "ConfigTests.swift")[0] + "examples/testini.ini"
9+
let filePath = #filePath.components(separatedBy: "ConfigTests.swift")[0] + "examples/testini.ini"
1010
let pool = NIOThreadPool(numberOfThreads: 1)
1111
pool.start()
1212
defer { try? pool.syncShutdownGracefully() }

Tests/CasbinTests/TestSupport.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import NIO
22

33
// Shared helpers for test file paths and small utilities
4-
public let TestsfilePath = #file.components(separatedBy: "TestSupport.swift")[0]
4+
public let TestsfilePath = #filePath.components(separatedBy: "TestSupport.swift")[0]
55

66
@inline(__always)
77
func tryBool(_ body: () throws -> Bool) -> Bool { (try? body()) ?? false }

0 commit comments

Comments
 (0)