最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

[已解决]swift代码出错:distance is unavailable call the distanceTo(end) method on the index

iOS crifan 494浏览 0评论

代码:

let offset = (index: semiRange.endIndex, offset: 1 – distance(position, semiRange.endIndex))

出错:

/Users/crifan/dev/dev_root/daryun/JianDao/iOS-Client/JianDao/CrifanLib.swift:867:74: ‘distance’ is unavailable: call the ‘distanceTo(end)’ method on the index

如图:

distance is unavailable call the distanceTo(end) method on the index

ios – ‘advancedBy’ API in Swift 2.0 – Stack Overflow

xcode – How to use "distanceTo", "advancedBy" to handle String in Xcode7 beta6 – Stack Overflow

再去参考:

StringExtensionHTML/StringExtensionHTML.swift at master · adela-chang/StringExtensionHTML

改为:

let offset = (index: semiRange.endIndex, offset: 1 position.distanceTo(semiRange.endIndex))

即可。

转载请注明:在路上 » [已解决]swift代码出错:distance is unavailable call the distanceTo(end) method on the index

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
59 queries in 0.094 seconds, using 18.59MB memory