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

Not an issue, a Swift 5 improvement #16

Open
stklieme opened this issue Jun 18, 2019 · 0 comments
Open

Not an issue, a Swift 5 improvement #16

stklieme opened this issue Jun 18, 2019 · 0 comments

Comments

@stklieme
Copy link

stklieme commented Jun 18, 2019

Thank you for sharing this amazing project. However I'd like to make a suggestion.

Even in Swift 4 it's recommended to prefer Data over NSData but in Swift 5 it became still more comfortable. You can replace the authorizationRef(fromExternalForm method with

 static func authorizationRef(fromExternalForm data: Data) throws -> AuthorizationRef? {

      // Create an AuthorizationExternalForm from it's data representation
      var authRef: AuthorizationRef?
      var authRefExtForm = data.withUnsafeBytes{ $0.load(as: AuthorizationExternalForm.self) }

      // Extract the AuthorizationRef from it's external form
      try executeAuthorizationFunction { AuthorizationCreateFromExternalForm(&authRefExtForm, &authRef) }
      return authRef
 }
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

No branches or pull requests

1 participant