From 1746641f317d828aa70123167ab02f97aa4d09d5 Mon Sep 17 00:00:00 2001 From: Edouard Siegel Date: Thu, 18 Feb 2021 17:45:48 +0100 Subject: [PATCH] Fix some warnings --- XCAssetPacker.xcodeproj/project.pbxproj | 7 ++++--- .../CommandLine/CommandLineKit/CommandLine.swift | 9 ++++----- XCAssetPacker/CommandLine/CommandLineKit/Option.swift | 2 +- .../CommandLine/CommandLineKit/StringExtensions.swift | 10 +++++----- XCAssetPacker/ImageProperties.swift | 2 +- XCAssetPacker/SwiftGeneration.swift | 5 +++-- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/XCAssetPacker.xcodeproj/project.pbxproj b/XCAssetPacker.xcodeproj/project.pbxproj index dac3b30..f682549 100644 --- a/XCAssetPacker.xcodeproj/project.pbxproj +++ b/XCAssetPacker.xcodeproj/project.pbxproj @@ -194,7 +194,7 @@ 4A56D1461DE5B573000B40D8 = { CreatedOnToolsVersion = 8.1; DevelopmentTeam = D92MT22EX5; - LastSwiftMigration = 0900; + LastSwiftMigration = 1220; ProvisioningStyle = Automatic; }; 4AD71E7B1EA4CCBA00016A1A = { @@ -210,6 +210,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 4A56D13E1DE5B573000B40D8; @@ -375,7 +376,7 @@ DEVELOPMENT_TEAM = D92MT22EX5; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -385,7 +386,7 @@ DEVELOPMENT_TEAM = D92MT22EX5; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/XCAssetPacker/CommandLine/CommandLineKit/CommandLine.swift b/XCAssetPacker/CommandLine/CommandLineKit/CommandLine.swift index 8b268ff..93551b1 100755 --- a/XCAssetPacker/CommandLine/CommandLineKit/CommandLine.swift +++ b/XCAssetPacker/CommandLine/CommandLineKit/CommandLine.swift @@ -130,7 +130,7 @@ public class CommandLine { */ public var maxFlagDescriptionWidth: Int { if _maxFlagDescriptionWidth == 0 { - _maxFlagDescriptionWidth = _options.map { $0.flagDescription.characters.count }.sorted().first ?? 0 + _maxFlagDescriptionWidth = _options.map { $0.flagDescription.count }.sorted().first ?? 0 } return _maxFlagDescriptionWidth @@ -306,8 +306,7 @@ public class CommandLine { continue } - let skipChars = arg.hasPrefix(longOptionPrefix) ? - longOptionPrefix.characters.count : shortOptionPrefix.characters.count + let skipChars = arg.hasPrefix(longOptionPrefix) ? longOptionPrefix.count : shortOptionPrefix.count let flagWithArg = arg[arg.index(arg.startIndex, offsetBy: skipChars).. String { var s = self - var currentLength = self.characters.count + var currentLength = self.count while currentLength < width { s.append(padChar) @@ -146,7 +146,7 @@ internal extension String { var currentLineWidth = 0 for word in self.split(by: splitBy) { - let wordLength = word.characters.count + let wordLength = word.count if currentLineWidth + wordLength + 1 > width { /* Word length is greater than line length, can't wrap */ diff --git a/XCAssetPacker/ImageProperties.swift b/XCAssetPacker/ImageProperties.swift index fbbc452..4146e1b 100644 --- a/XCAssetPacker/ImageProperties.swift +++ b/XCAssetPacker/ImageProperties.swift @@ -82,7 +82,7 @@ struct ImageProperties { static var typesForSuffixes: [(String, ImageType)] { - return ImageType.all.flatMap { (type) in + return ImageType.all.compactMap { (type) in if let suffix = type.suffix { return (suffix, type) } else { diff --git a/XCAssetPacker/SwiftGeneration.swift b/XCAssetPacker/SwiftGeneration.swift index 239175a..cee7097 100644 --- a/XCAssetPacker/SwiftGeneration.swift +++ b/XCAssetPacker/SwiftGeneration.swift @@ -206,8 +206,9 @@ extension String { self.enumerateSubstrings(in: startIndex.. 0 { + let firstCharacterOfWord = substring.removeFirst() var firstLetterOfWord = String(firstCharacterOfWord) firstLetterOfWord = isFirstLetter ? firstLetterOfWord.lowercased() : firstLetterOfWord.uppercased() adaptedText += firstLetterOfWord + substring