@@ -53,14 +53,16 @@ func localizedStrings(inStringFile: String) -> [String] {
5353 var localizedStrings = [ String] ( )
5454 let patterns = [
5555 " #imageLiteral \\ (resourceName: \" ([ \\ w-]+) \" \\ ) " , // Image Literal
56- " UIImage \\ (named: \" ( \\ w+) \" \\ ) " // Default UIImage call
56+ " UIImage \\ (named: \" ( \\ w+) \" \\ ) " , // Default UIImage call
57+ " \\ <image name= \" ([ \\ w-]+) \" .* " , // Storyboard resources
58+ " R.image.([ \\ w-]+) \\ ( \\ ) " //R.swift support
5759 ]
5860 for p in patterns {
5961 let regex = try ? NSRegularExpression ( pattern: p, options: [ ] )
6062 let range = NSRange ( location: 0 , length: ( inStringFile as NSString ) . length)
6163 regex? . enumerateMatches ( in: inStringFile, options: [ ] , range: range) { result, _, _ in
6264 if let r = result {
63- let value = ( inStringFile as NSString ) . substring ( with: r. rangeAt ( 1 ) )
65+ let value = ( inStringFile as NSString ) . substring ( with: r. range ( at : 1 ) )
6466 localizedStrings. append ( value)
6567 }
6668 }
@@ -72,9 +74,10 @@ func listUsedAssetLiterals() -> [String] {
7274 let sourcesPath = FileManager . default. currentDirectoryPath + sourcePath
7375 let enumerator = FileManager . default. enumerator ( atPath: sourcesPath)
7476 return elementsInEnumerator ( enumerator)
75- . filter { $0. hasSuffix ( " .swift " ) || $0. hasSuffix ( " .m " ) } // Only Swift and Obj-C files
77+ . filter { $0. hasSuffix ( " .m " ) || $0 . hasSuffix ( " . swift" ) || $0. hasSuffix ( " .xib " ) || $0 . hasSuffix ( " .storyboard " ) } // Only Swift and Obj-C files
7678 . map { " \( sourcesPath) / \( $0) " } // Build file paths
7779 . map { try ? String ( contentsOfFile: $0, encoding: . utf8) } // Get file contents
80+ . flatMap { $0}
7881 . flatMap { $0} // Remove nil entries
7982 . map ( localizedStrings) // Find localizedStrings ocurrences
8083 . flatMap { $0} // Flatten
@@ -100,3 +103,4 @@ broken.forEach { print("\(assetCatalogAbsolutePath):: error: [Asset Missing] \($
100103if broken. count > 0 {
101104 exit ( 1 )
102105}
106+
0 commit comments