It only seems to happen when a lone paragraph separator is passed to it: "\u{2029}"
Xcode 16 Playground code that will reproduce the crash:
import Foundation
/// Fails when using Xcode 16.0 beta 8 Playground and when running on iOS 17 beta.
let paragraphSeparator = "\u{2029}"
/// Try adding a character before or after the separator - it should not crash.
let string = paragraphSeparator
let range = string.startIndex ..< string.endIndex
/// Throws an exception.
let outRange = string.paragraphRange(for: range)
/// Success if this was reached.
print(string)
To test:
Run the AztecExample demo app in the Simulator or on a real device running iOS 17
Tap "Standard Demo"
Place the cursor at the end of the top line "Welcome to Aztec"
Erase characters until there are no more to erase
Expect: No exception is thrown and the app doesn't crash.
Repeat the test for iOS 16.
[x] I have considered if this change warrants release notes and have added them to the appropriate section in the CHANGELOG.md if necessary.
Fixes #1374
Addresses a crash that occurs when calling
String.paragraphRange(for:)
. The workaround for now is to call theNSString
equivalent.Related issue: https://github.com/wordpress-mobile/WordPress-iOS/issues/21261
String.lineRange(for:)
Xcode 16 Playground code that will reproduce the crash:
To test:
Repeat the test for iOS 16.
CHANGELOG.md
if necessary.