try mysteryData.write(to: mysteryDataURL.appendPathExtension("txt"))
operates on a constant mysteryDataURL and my playground gives me an error to change ‘let’ to ‘var’ to make mysteryDataURL mutable. But yours isn’t mutable either… why aren’t you getting the same error?
Subtle difference in API! You’re using
appendPathExtension, which mutates a URL.
appendingPathExtension, which creates a new
URL based on a previous
Swift is full of this “ing”/non-“ing” stuff now. It can be tricky when paired with autocomplete. Sorry it bit you!
This topic was automatically closed after 166 days. New replies are no longer allowed.
I was wondering if you might now how to do the following. I have been pulling my hair out and scouring the internet trying to piece together information regarding it.
I am wanting to take a Swift class instance, and convert it into its binary data, so I can perform an XOR, and store the difference between two different instances. I would then apply or remove the stored xor result to move between the two states. Kind of like an undo/redo.
I have been pulling my hair out trying to wrap my hair around Swifts Data, and converting data to bytes.
Any help would be awesome, Thanks