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

[iOS] Refactor error and data access #2733

Open
wants to merge 2 commits into
base: 4.2
Choose a base branch
from

Conversation

pbk20191
Copy link

  1. Declare SpineError
  • Declaring conformance of standard protocol Error to standard library type String is highly discouraged. So I created SpineError which can be used with the same syntax as before while using Explicit type.
  1. Support URLSessionDownloadTask cancellation
  • URLSession async download does supports Task cancellation, while current implementation does not, this commit will support Task cancellation below iOS 15.0
  1. refactor accessing binary or c-String memory region
  • current implementation may have dangling pointer and access pointer out of scope that the Swift guarantee.
  • casting Swift.String to NSString can cause implicit deep copy which is not needed.
  • According to the guideline, only access the pointer inside the scope is safe.
  • this pr, move the access to the Data, String memory, inside the block scope which is guaranteed to be safe.

declaring conformance to Error on String is discouraged, and Creating own Error type is recommended
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