Skip to content

Conversation

@zamderax
Copy link
Contributor

@zamderax zamderax commented Oct 16, 2025

Summary

Add async/await overloads for Config and DefaultModel static factory methods, continuing the Swift 6 concurrency migration started in PR #53.

Changes

Config+AsyncAwait.swift

  • Added async/await overloads for from(file:fileIo:on:) static factory method
  • Added async/await overloads for from(text:on:) static factory method
  • Methods bridge existing EventLoopFuture-based APIs using continuation pattern
  • Availability-gated with @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)

DefaultModel+AsyncAwait.swift

  • Added async/await overloads for from(file:fileIo:on:) static factory method
  • Added async/await overloads for from(text:on:) static factory method
  • Methods bridge existing EventLoopFuture-based APIs using continuation pattern
  • Availability-gated with @available(macOS 10.15, iOS 13.0, tvOS 13.0, *)

Implementation Pattern

Test Plan

Related PRs

zamderax and others added 3 commits October 16, 2025 10:20
- Add async/await overloads for named policy and grouping policy methods
- Add async/await overloads for RBAC API methods (permissions, roles, users)
- Create comprehensive test suites for ManagementApi and RBACApi async/await methods
- Properly manage EventLoopGroup lifecycle in tests with defer cleanup
- All 13 tests passing (6 Management + 7 RBAC)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Rename Sources/Casbin/APi/RBACApi.swift to RBACAPI.swift
- Rename Tests/CasbinTests/RbacApiTests.swift to RBACAPITests.swift
- Update struct name from RbacApiTests to RBACAPITests
- All 15 tests passing (2 RBAC API + 6 Management + 7 RBAC Async)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add Config+AsyncAwait.swift with async/await overloads for static factory methods
- Add DefaultModel+AsyncAwait.swift with async/await overloads for static factory methods
- Both follow the same pattern as PR casbin#53 with @available annotations and continuation-based bridging
- Methods bridge existing EventLoopFuture-based APIs to async/await

Note: Tests have a pre-existing hang issue on this branch unrelated to these changes.
The code compiles successfully and follows the established async/await patterns.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@zamderax zamderax marked this pull request as draft October 16, 2025 09:39
@hsluoyz
Copy link
Member

hsluoyz commented Oct 19, 2025

@zamderax is this ready?

@zamderax
Copy link
Contributor Author

zamderax commented Oct 19, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants