Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

384
Views
Portar JS a Swift - Error: No hay coincidencias exactas en la llamada al subíndice

Este es el código JS:

 const textLength = textContent.length; let string = ''; for (let i = 0; i < textLength; i++) { if (string !== '' && offsetsSet.has(i)) { parts.push(string); string = ''; } string += textContent[i]; }

Este es mi código Swift que he portado a Swift:

 override func getTextPart() -> String { guard let textNode = getLatest() as? TextNode else { return text } return textNode.text } public func splitText(splitOffsets: [Int]) throws -> [Node] { let textContent = getTextPart() let textLength = textContent.count let offsetsSet = Set(splitOffsets) var parts = [String]() var string = "" for i in 0..<textLength { if string != "" && offsetsSet.contains(i) { parts.append(string) string = "" } string += textContent[i] //Error: No exact matches in call to subscript } }

Recibo un error en esta línea: string += textContent[i]//Error: No exact matches in call to subscript. ¿Cómo escribo esto en swift?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!