- Notifications
You must be signed in to change notification settings - Fork 149
Closed
Description
Describe the bug
iOS 17 crashes when String.paragraphRange(for:)
is called when the range passed in is for a single paragraph separator character: \u{2029}
To Reproduce
Steps to reproduce the behavior:
- Run the AztecExample demo app in the Simulator or on a real device
- Tap "Standard Demo"
- Place the cursor at the end of the top line "Welcome to Aztec"
- Erase characters until the app crashes
Expected behavior
The app to erase the characters without crashing.
Screenshots
Video | Exception |
---|---|
Simulator.Screen.Recording.-.iPhone.14.-.2023-09-11.at.16.36.11.mp4 | ![]() |
Smartphone (please complete the following information):
- Device: iPhone 14
- OS: iOS 17.0 (21A5326a)
Additional context
- This also applies to String.lineRange(for:)
- The NSString equivalent functions do not crash
- Apple Feedback has been submitted:
FB13142115
The following Playground in Xcode 16 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)