In swift,I can use subSting() method to get a subString like this:
let sessionId = "this is a test"
let index = sessionId.index(sessionId.startIndex, offsetBy: 2)
let prefix = sessionId.substring(to: index)
But,today I found the method'availability is iOS 10 and later.How to handle this problem for you guys?
Availability iOS (10.0 and later), macOS (10.12 and later), tvOS (10.0 and later), watchOS (3.0 and later)