Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 5:为什么选择范围<;String.Index>;。即使提供空字符串作为参数,Bound.utf16Offset也会计算偏移量_Swift - Fatal编程技术网

Swift 5:为什么选择范围<;String.Index>;。即使提供空字符串作为参数,Bound.utf16Offset也会计算偏移量

Swift 5:为什么选择范围<;String.Index>;。即使提供空字符串作为参数,Bound.utf16Offset也会计算偏移量,swift,Swift,在Swift 4中,我有一个将范围转储到调试器输出的函数,定义如下: 扩展范围,其中Bound==String.Index{ public func dump()->字符串{ 返回“[\(lowerBound.encodedOffset)…不要使用编码偏移量,请使用字符串距离方法。请尝试”为什么不使用rangecount属性?range.count导致错误Type'String.Index'不符合协议'streable':0my bad。您需要一个字符串实例来计算距离let String=”

在Swift 4中,我有一个将范围转储到调试器输出的函数,定义如下:

扩展范围,其中Bound==String.Index{
public func dump()->字符串{

返回“[\(lowerBound.encodedOffset)…不要使用编码偏移量,请使用字符串距离方法。请尝试
”为什么不使用range
count
属性?
range.count
导致错误
Type'String.Index'不符合协议'streable'
:0my bad。您需要一个字符串实例来计算距离
let String=”