Skip to content

Not an issue, a Swift 5 improvement #16

Open
@stklieme

Description

@stklieme

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
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions