1

I can do conditional breaks in Xcode using string compare?

something like: theLabel.text.range(of:"4") != nil

S'rCat
  • 468
  • 1
  • 4
  • 16
  • At what moment(s) do you want that expression evaluated? – matt Feb 06 '18 at 03:02
  • I'd like to set it in the normal Xcode breakpoint fields, so evaluated everything the breakpoint is hit. – S'rCat Feb 06 '18 at 17:47
  • Cool. So did you try setting a conditional breakpoint? Double-click the breakpoint indicator and enter the expression you want evaluated. – matt Feb 06 '18 at 17:52

1 Answers1

2

You are describing a conditional breakpoint. Double-click the breakpoint marker and enter the expression you want evaluated. You will break only if the expression is true.

Be sure to test your expression in code, first, to make sure it is valid. In your case, you need to remember that text is an Optional:

enter image description here

matt
  • 515,959
  • 87
  • 875
  • 1,141