Skip to content

Conversation

@Sajjon
Copy link

@Sajjon Sajjon commented Nov 22, 2025

Several improvements to the SDK and minor adjustments to the demo app.

platforms SPM settings

Use platforms settings in Package.swift - this allows us to drop #available checks in code. Rationale: it is better to fail at compile time for developers using the Package instead of failing at runtime for users.

Use local SPM package in Demo app instead of remote.

I've change so that the Demo app now uses the local Package instead of a remote. This is the intended usage (or should be!), allowing us to test our unmerged changes. This requires the DfnsDemo/Package.swift trick.

(Pre)Concurrency fixes

The codebase is not at all prepared for strict concurrency checking / Swift Language Version: 6. So I've fixed the low hanging fruit:

  • Package: Marked all structs in DfnsApi namespace as Sendable
  • Package: Marked required closures @Sendable and all in Sources/DfnsSdk/Imported/Passkey.swift
  • DemoApp: Marked import of DfnsSdk with @preconcurrency to silence some concurrency warnings
  • DemoApp: Ensure Strict Concurrency Checking is set to Minimal for all targets (project level)
  • DemoApp: Ensure Swift Language Version is set to 5 for all targets (project level)

Swift best practices

"Closed" the namespace enum DfnsApi directly (enum DfnsApi {}) making it clear it is just a namespace enum You should consider removing it, you can already do DfnsSdk.AtypeInThePackage when consumed in e.g. Demo app. These kind of namespaces are common on feature level, but not really needed on package level. Furthermore, if any symbols do conflict there are other ways to disambiguate, e.g. if conflicting with Swift Foundation types one can do e.g. Foundation.Data and ultimately SE-0491 will allow for full disambiguation,

In Swift it is best practice to put the initialiser below the stored properties of a type, which I've changed to.

I've also added // MARK: MyType annotations in Sources/DfnsSdk/DfnsApi.swift for best minimap rendering (see minimap on right hand side):

Screenshot 2025-11-22 at 08 05 18

This also allows for usage of "jump bar" (CTRL 6) allowing us to jump to symbols within a large file

@Sajjon Sajjon force-pushed the cyon/replace_available_with_platform_in_package_swift branch 2 times, most recently from 5b46e90 to cb2f643 Compare November 22, 2025 07:13
@Sajjon Sajjon force-pushed the cyon/replace_available_with_platform_in_package_swift branch from cb2f643 to a932873 Compare November 22, 2025 07:14
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
Copy link
Author

Choose a reason for hiding this comment

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

Removed from the target DfnsDemo and moved to the DfnsDemo project (thus covering ALL targets, e.g. unit test targets when/if added).

(You will see two of these guys, one for Debug and one for Release.)

Wrapper class for the Passkey class imported from the `react-native-passkey library`
Converts completion handlers into async functions and make the necessary conversion to work with Dfns API
*/
public final class PasskeysSigner {
Copy link
Author

Choose a reason for hiding this comment

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

Git made a poor rendering of this diff.... I've removed #available checks, which are not needed thanks to newly added:

platforms: [
	.macOS(.v10_15),
	.iOS(.v15),
	.watchOS(.v6),
	.tvOS(.v13)
],

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.

1 participant