Removes use of deprecated String.characters property
This commit is contained in:
parent
fb5036acf8
commit
356d843a9b
@ -1 +1 @@
|
||||
Subproject commit 1d74f647aaeec653a3ab55d7c06a0b3c0dc95069
|
||||
Subproject commit c1443afa0ede9100a0cc64a9d985636b6384af01
|
||||
@ -340,7 +340,7 @@ private extension GameCollectionViewController
|
||||
|
||||
func rename(_ game: Game, with name: String)
|
||||
{
|
||||
guard name.characters.count > 0 else { return }
|
||||
guard name.count > 0 else { return }
|
||||
|
||||
DatabaseManager.shared.performBackgroundTask { (context) in
|
||||
let game = context.object(with: game.objectID) as! Game
|
||||
@ -401,7 +401,7 @@ private extension GameCollectionViewController
|
||||
@objc func textFieldTextDidChange(_ textField: UITextField)
|
||||
{
|
||||
let text = textField.text ?? ""
|
||||
self._renameAction?.isEnabled = text.characters.count > 0
|
||||
self._renameAction?.isEnabled = text.count > 0
|
||||
}
|
||||
|
||||
@objc func handleLongPressGesture(_ gestureRecognizer: UILongPressGestureRecognizer)
|
||||
|
||||
@ -49,7 +49,7 @@ extension CheatTextView
|
||||
{
|
||||
let characterWidth = ("A" as NSString).size(withAttributes: [.font: font]).width
|
||||
|
||||
let width = characterWidth * CGFloat(format.format.characters.count)
|
||||
let width = characterWidth * CGFloat(format.format.count)
|
||||
self.textContainer.size = CGSize(width: width, height: 0)
|
||||
}
|
||||
}
|
||||
@ -134,7 +134,7 @@ extension CheatTextView: NSLayoutManagerDelegate
|
||||
if let prefix = attributedFormat.attributes(at: characterIndex, effectiveRange: nil)[.cheatPrefix] as? String
|
||||
{
|
||||
// If there is a prefix string, we insert the glyphs (and associated properties/character indexes) first
|
||||
let prefixCount = prefix.characters.count
|
||||
let prefixCount = prefix.count
|
||||
|
||||
for j in 0 ..< prefixCount
|
||||
{
|
||||
|
||||
@ -51,7 +51,7 @@ struct CheatValidator
|
||||
// Remove newline characters (code should already be formatted)
|
||||
let sanitizedCode = (cheat.code as NSString).replacingOccurrences(of: "\n", with: "")
|
||||
|
||||
if sanitizedCode.characters.count % self.format.format.characters.count != 0
|
||||
if sanitizedCode.count % self.format.format.count != 0
|
||||
{
|
||||
throw Error.invalidCode
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ extension EditCheatViewController
|
||||
|
||||
// Update UI
|
||||
|
||||
if name.characters.count == 0
|
||||
if name.count == 0
|
||||
{
|
||||
self.title = NSLocalizedString("Cheat", comment: "")
|
||||
}
|
||||
@ -224,7 +224,7 @@ private extension EditCheatViewController
|
||||
@IBAction func updateCheatName(_ sender: UITextField)
|
||||
{
|
||||
var title = sender.text ?? ""
|
||||
if title.characters.count == 0
|
||||
if title.count == 0
|
||||
{
|
||||
title = NSLocalizedString("Cheat", comment: "")
|
||||
}
|
||||
|
||||
@ -377,7 +377,7 @@ private extension SaveStatesViewController
|
||||
func rename(_ saveState: SaveState, with name: String?)
|
||||
{
|
||||
var name = name
|
||||
if (name ?? "").characters.count == 0
|
||||
if (name ?? "").count == 0
|
||||
{
|
||||
// When text is nil, we know to show the timestamp instead
|
||||
name = nil
|
||||
|
||||
Loading…
Reference in New Issue
Block a user