Skip to content

Refactored NFCConnection in preparation of Swift 6 #28

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jdmoreira
Copy link
Member

@jdmoreira jdmoreira commented Jun 3, 2025

Motivation

In preparation to make the sdk build in Swift 6 it was needed to refactor the NFCConnection.
The new implementation wraps all the calls to CoreNFC in an actor. I verified this compiles without errors or warnings in Swift 6.1.
The end to end tests are all passing for this connection and I tried to keep the same api and throwing error semantics as before.

Similar to what was done in #20 for the SmartCardConnection

Extras

  • asyncMap caused errors with Swift 6 so I had to remove it to make it compile 95784ac

@jdmoreira jdmoreira requested a review from Copilot June 3, 2025 07:03
Copilot

This comment was marked as resolved.

@jdmoreira jdmoreira self-assigned this Jun 3, 2025
@jdmoreira jdmoreira force-pushed the joao/nfc-connection-refactor branch from 11bd149 to 6586f21 Compare June 3, 2025 14:00
@jdmoreira jdmoreira force-pushed the joao/nfc-connection-refactor branch from 6586f21 to 95784ac Compare June 3, 2025 14:32
@jdmoreira jdmoreira requested a review from Copilot June 3, 2025 14:34
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors NFC connection handling and related OATH session processing while removing an unused asynchronous mapping extension. Key changes include:

  • Removal of the Sequence+Extensions.swift file which previously provided an asyncMap extension.
  • Introduction of a new NFC logging protocol in Logger+Extensions.swift.
  • Refactoring of OATH session code to replace asyncMap with a loop-based approach, along with corresponding updates in full-stack tests.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
YubiKit/YubiKit/Utilities/Sequence+Extensions.swift Removed unused asyncMap extension.
YubiKit/YubiKit/Utilities/Logger+Extensions.swift Added HasNFCLogger protocol to support NFC-specific logging.
YubiKit/YubiKit/OATH/OATHSession.swift Replaced asyncMap with a for-loop to build credential-code pairs.
FullStackTests/Tests/OATHFullStackTests.swift Updated OATH tests to adapt to the loop-based implementation.
FullStackTests/Tests/ConnectionFullStackTests.swift Updated asynchronous logger calls to await the asynchronous method.

@jdmoreira jdmoreira changed the title NFC Connection refactor Refactored NFCConnection in preparation of Swift 6 Jun 3, 2025
@jdmoreira jdmoreira marked this pull request as ready for review June 3, 2025 14:43
@jdmoreira jdmoreira force-pushed the joao/nfc-connection-refactor branch from 386578d to 4bfa427 Compare June 10, 2025 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant