Fix substring depreciated warnings
This commit is contained in:
parent
774f05eae0
commit
f646762f4b
3 changed files with 4 additions and 4 deletions
|
|
@ -61,7 +61,7 @@ class GitSSHKeyArmorSettingTableViewController: UITableViewController, UITextVie
|
|||
// update full text and check whether we are done
|
||||
key.append(segment)
|
||||
if let index1 = key.range(of: "-----END")?.lowerBound,
|
||||
let _ = key.substring(from: index1).range(of: "KEY-----")?.lowerBound {
|
||||
let _ = key.suffix(from: index1).range(of: "KEY-----")?.lowerBound {
|
||||
isDone = true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ extension PasswordEntity {
|
|||
public var nameWithCategory: String {
|
||||
get {
|
||||
if let p = path, p.hasSuffix(".gpg") {
|
||||
return p.substring(to: p.index(p.endIndex, offsetBy: -4))
|
||||
return String(p.prefix(upTo: p.index(p.endIndex, offsetBy: -4)))
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ public class PasswordStore {
|
|||
}.map { (filename) -> PasswordEntity in
|
||||
let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity
|
||||
if filename.hasSuffix(".gpg") {
|
||||
passwordEntity.name = filename.substring(to: filename.index(filename.endIndex, offsetBy: -4))
|
||||
passwordEntity.name = String(filename.prefix(upTo: filename.index(filename.endIndex, offsetBy: -4)))
|
||||
} else {
|
||||
passwordEntity.name = filename
|
||||
}
|
||||
|
|
@ -369,7 +369,7 @@ public class PasswordStore {
|
|||
let files = try fm.contentsOfDirectory(atPath: filePath).map { (filename) -> PasswordEntity in
|
||||
let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity
|
||||
if filename.hasSuffix(".gpg") {
|
||||
passwordEntity.name = filename.substring(to: filename.index(filename.endIndex, offsetBy: -4))
|
||||
passwordEntity.name = String(filename.prefix(upTo: filename.index(filename.endIndex, offsetBy: -4)))
|
||||
} else {
|
||||
passwordEntity.name = filename
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue