Skip to content
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

Refactor: Clean up and follow official naming conventions #21

Merged
merged 1 commit into from Mar 27, 2024
Merged

Conversation

bisgardo
Copy link
Contributor

This change is purely renaming and deletion of files and types. There are no changes in behavior.

  • Renamed product from ConcordiumSwiftSdk to simply Concordium. This is the name that will be used for imports, so it should be clear and without redundancy like "swift".
  • Renamed example CLI from GrpcCli to just CLI and the produced executable to concordium.
  • Removed ./ExampleWallet. A new one is going to be built from scratch in ./examples.
  • Follow naming conventions from the official API Design Guidelines. I've previously named things according to my personal preferences (i.e. GrpcNodeClient instead of GRPCNodeClient), but the conventions are clear and we should follow them.

- Renamed product from `ConcordiumSwiftSdk` to simply `Concordium`. This is the name that will be used for imports, so it should be clear and without redundancy like "swift".
- Removed `./ExampleWallet`. A new one is going to be built from scratch in `./examples`.
- Follow naming conventions from the official [API Design Guidelines](https://www.swift.org/documentation/api-design-guidelines/). I've previously named things according to my personal preferences (i.e. `GrpcNodeClient` instead of `GRPCNodeClient`), but the conventions are clear and we should follow them.
@bisgardo bisgardo merged commit 62c6525 into main Mar 27, 2024
1 check passed
@bisgardo bisgardo deleted the style branch March 27, 2024 10:18
bisgardo added a commit that referenced this pull request Mar 28, 2024
- Some types and variables that aren't named according to the official [API Design Guidelines](https://www.swift.org/documentation/api-design-guidelines/) but were missed in #21 have been renamed appropriately.
- New type aliases for identity parameters are added.
- The intermediate type `VerifyKeyGrpc` is replaced with an extension `fromGRPCType` on `VerifyKey` from `ConcordiumWalletCrypto`.
- The functions the convert values from the generated gRPC types have been tightened up to not accept `nil` values and ensure that optional values are explicitly handled at the right place.
bisgardo added a commit that referenced this pull request Mar 28, 2024
- Some types and variables that aren't named according to the official [API Design Guidelines](https://www.swift.org/documentation/api-design-guidelines/) but were missed in #21 have been renamed appropriately.
- New type aliases for identity parameters are added.
- The intermediate type `VerifyKeyGrpc` is replaced with an extension `fromGRPCType` on `VerifyKey` from `ConcordiumWalletCrypto`.
- The functions the convert values from the generated gRPC types have been tightened up to not accept `nil` values and ensure that optional values are explicitly handled at the right place.
bisgardo added a commit that referenced this pull request Apr 2, 2024
- Some types and variables that aren't named according to the official [API Design Guidelines](https://www.swift.org/documentation/api-design-guidelines/) but were missed in #21 have been renamed appropriately.
- New type aliases for identity parameters are added.
- The intermediate type `VerifyKeyGrpc` is replaced with an extension `fromGRPCType` on `VerifyKey` from `ConcordiumWalletCrypto`.
- The functions the convert values from the generated gRPC types have been tightened up to not accept `nil` values and ensure that optional values are explicitly handled at the right place.
bisgardo added a commit that referenced this pull request Apr 2, 2024
# Example CLI renaming

When working on the next features, we ran into a [known bug in Swift](apple/swift#55127) that prevents the annotation `@main` from being usable from within a file named `main.swift`.

According to a [note in the docs of `ArgumentParser`](https://apple.github.io/swift-argument-parser/documentation/argumentparser/gettingstarted/) (and apparently not documented anywhere else), this shouldn't work at all:

> The Swift compiler uses either the type marked with @main or a main.swift file as the entry point for an executable program. You can use either one, but not both [...]

So it's a bit of a mystery why it works in the current version, but not once more features are added...

To fix the problem we rename `main.swift` to `commands.swift`. It also turns out that by upgrading to `swift-tools-version: 5.9`, we can abbreviate the setup to omit the "executable product" declaration and the intermediary directory inside `Sources`.

Also, the executable is renamed to `concordium-example-client` to ensure that it never is mistaken for a production ready tool.

Finally, some variables are renamed for consistency and the readme got an overhaul.

# Vaious cleanup

- Some types and variables that aren't named according to the official [API Design Guidelines](https://www.swift.org/documentation/api-design-guidelines/) but were missed in #21 have been renamed appropriately.
- New type aliases for identity parameters are added.
- The intermediate type `VerifyKeyGrpc` is replaced with an extension `fromGRPCType` on `VerifyKey` from `ConcordiumWalletCrypto`.
- The functions the convert values from the generated gRPC types have been tightened up to not accept `nil` values and ensure that optional values are explicitly handled at the right place.
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.

None yet

2 participants