Skip to content

Add NSRange/Range conversion API support on Linux #5260

@gjcairo

Description

@gjcairo

Currently trying to do things like the following only work on Darwin:

let swiftRange = Range(range, in: string)
                         | `- error: initializer 'init(_:in:)' requires that 'NSRange' (aka '_NSRange') conform to 'RangeExpression'

It's possible to work around this by, for example, creating the Range manually:

let start = string.utf16.index(string.startIndex, offsetBy: range.location)
let end = string.utf16.index(start, offsetBy: range.length)
let swiftRange = start ..< end

But it would be great to have full conversion support between NSRange and Swift.Range on Linux too.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions