0

How do I change this value directoryPath

  let directoryPath = String(URL(fileURLWithPath: filePath).deletingLastPathComponent().absoluteString.dropLast())
  if createDirectory(filePath: directoryPath) {
}
swifter
  • 1
  • 1

1 Answers1

0

A constant value like this may not have a single copy for the debugger to modify; you could sometimes see the same issue with a const variable in a C/C++ program, it's even more of a common problem with Swift programs. In general, this is not modifiable in the debugger.

Jason Molenda
  • 14,835
  • 1
  • 59
  • 61
  • Note, at present setting swift `var` variables is also somewhat hit and miss in the debugger. As Jason hinted, for various technical reasons the swift compiler will sometimes make a shadow copy of a variable and present the shadow copy to the debugger. Swift keeps the shadow copy up to date, but doesn't actually use its value. So changing the value will appear to work in the debugger, because you really did change the shadow copy, but that won't change the running of your code. This is a known bug, but fixing it in swift turns out to be quite tricky... – Jim Ingham Jan 08 '21 at 01:53