Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from SwiftGen to String catalog #38

Merged
merged 6 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,4 @@ Dir.chdir "Sources" do

markdown message
end
end

# Checking for missing strings
`support/verify-string-files -master Sources/iOSSampleApp/Resources/Base.lproj/Localizable.strings -warning-level warning &> verify-string-files.txt`
result = File.readlines('verify-string-files.txt')
if result.count > 0
message = "### Missing translations\n\n".dup

message << "Language | Key | \n"
message << "| --- | ----- \n"
result.each { |line|
index = line.index(": warning:") + 11
line = line[index...-1]
lang = line.rpartition(' ').last.sub(".lproj", "").upcase()
if lang == "SK"
lang = "🇸🇰 SK"
end
key = line.rpartition(' ').first.sub("is missing in", "")
message << "#{lang} | #{key} \n"
}
markdown message
end
`rm verify-string-files.txt`
end
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# iOS Sample App

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Platforms](https://img.shields.io/badge/platform-iOS-lightgrey.svg)
[![Swift Version](https://img.shields.io/badge/Swift-5-F16D39.svg?style=flat)](https://developer.apple.com/swift)
[![Twitter](https://img.shields.io/badge/twitter-@igorkulman-blue.svg)](http://twitter.com/igorkulman)

Sample iOS app written the way I write iOS apps because I cannot share the app I currently work on.

## Shown concepts
Expand All @@ -19,10 +14,10 @@ Sample iOS app written the way I write iOS apps because I cannot share the app I

### Other concepts

* Localization to 2 languages with [safer string usage](https://blog.kulman.sk/using-ios-strings-in-a-safer-way/) and checking for missing translations
* Localization to 2 languages with String catalogs
* Continuous integration with Github Actions and Danger
* Unit testing, including [testing view controllers for leaks](https://blog.kulman.sk/unit-testing-memory-leaks/)
* Creating a view controller in code when Storyboard cannot be used
* Creating a view controller in code with dependency injection
* Using static UITableView cells in a typed way with enums
* Creating simple cells with UIListContentConfiguration
* Automated AppStore screenshots taking in multiple languages
Expand Down Expand Up @@ -51,7 +46,6 @@ Sample iOS app written the way I write iOS apps because I cannot share the app I
- [SpecLeaks](leandromperez/specleaks) - Unit Tests Memory Leaks in Swift. Write readable tests for mem leaks easily with these Quick and Nimble extensions
- [Quick](https://github.com/Quick/Quick) - The Swift (and Objective-C) testing framework
- [Nimble](https://github.com/Quick/Nimble) - A Matcher Framework for Swift and Objective-C
- [SwiftGen](https://github.com/SwiftGen/SwiftGen) - The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs
- [SwifLint](https://github.com/realm/SwiftLint) - A tool to enforce Swift style and conventions

## Author
Expand Down
83 changes: 7 additions & 76 deletions Sources/iOSSampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
F33474FA244F67270034B1C2 /* RxSwiftExt in Frameworks */ = {isa = PBXBuildFile; productRef = F33474F9244F67270034B1C2 /* RxSwiftExt */; };
F33A1F4124C9866F008ED2BD /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = F33A1F4024C9866F008ED2BD /* Log.swift */; };
F33EB3FE1FBDD81F0050560D /* UIViewController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F33EB3FD1FBDD81F0050560D /* UIViewController+Extensions.swift */; };
F3520E74206017000011EF40 /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3520E73206017000011EF40 /* Strings.swift */; };
F35BD6392065111F000AE4E8 /* AppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F35BD6382065111F000AE4E8 /* AppUITests.swift */; };
F3651D22203C1B0D0082A73A /* DataService.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3651D21203C1B0D0082A73A /* DataService.swift */; };
F3651D26203C1B3A0082A73A /* SettingsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3651D25203C1B3A0082A73A /* SettingsService.swift */; };
F3659D2F2B52A18000029D22 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = F3659D2E2B52A18000029D22 /* Localizable.xcstrings */; };
F376423625A4689800C58CE5 /* Nuke in Frameworks */ = {isa = PBXBuildFile; productRef = F376423525A4689800C58CE5 /* Nuke */; };
F37781152085E14C00146DBE /* Optional+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F37781142085E14C00146DBE /* Optional+Extensions.swift */; };
F38CD1BD1F8382950050056C /* RssSourceViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F38CD1BC1F8382950050056C /* RssSourceViewModel.swift */; };
Expand Down Expand Up @@ -83,8 +83,6 @@
F3CBB19621CCFFA00023EE18 /* RxSwift+WKWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3CBB19521CCFFA00023EE18 /* RxSwift+WKWebView.swift */; };
F3D6865C1F9B761E00879154 /* TestExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3D6865B1F9B761E00879154 /* TestExtensions.swift */; };
F3D7D14B2441C599001695B9 /* DebugUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3D7D14A2441C599001695B9 /* DebugUtils.swift */; };
F3D9327C21628CDE00EA1E91 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F3D9327E21628CDE00EA1E91 /* Localizable.strings */; };
F3D9328521628D2300EA1E91 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F3D9328321628D2300EA1E91 /* Localizable.strings */; };
F3EEA696234A3BE800A2FCB5 /* SnapshotHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3EEA695234A3BE800A2FCB5 /* SnapshotHelper.swift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -113,12 +111,12 @@
F3208A911F84EAF400B57B0E /* CustomSourceViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSourceViewModelTests.swift; sourceTree = "<group>"; };
F33A1F4024C9866F008ED2BD /* Log.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Log.swift; sourceTree = "<group>"; };
F33EB3FD1FBDD81F0050560D /* UIViewController+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extensions.swift"; sourceTree = "<group>"; };
F3520E73206017000011EF40 /* Strings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = "<group>"; };
F35BD6362065111F000AE4E8 /* iOSSampleAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOSSampleAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
F35BD6382065111F000AE4E8 /* AppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppUITests.swift; sourceTree = "<group>"; };
F35BD63A2065111F000AE4E8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F3651D21203C1B0D0082A73A /* DataService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataService.swift; sourceTree = "<group>"; };
F3651D25203C1B3A0082A73A /* SettingsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsService.swift; sourceTree = "<group>"; };
F3659D2E2B52A18000029D22 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
F37781142085E14C00146DBE /* Optional+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Optional+Extensions.swift"; sourceTree = "<group>"; };
F38CD1BC1F8382950050056C /* RssSourceViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RssSourceViewModel.swift; sourceTree = "<group>"; };
F38CD1BF1F8384490050056C /* Bundle+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+Extensions.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -175,8 +173,6 @@
F3CBB19521CCFFA00023EE18 /* RxSwift+WKWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RxSwift+WKWebView.swift"; sourceTree = "<group>"; };
F3D6865B1F9B761E00879154 /* TestExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestExtensions.swift; sourceTree = "<group>"; };
F3D7D14A2441C599001695B9 /* DebugUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugUtils.swift; sourceTree = "<group>"; };
F3D9327F21628CE200EA1E91 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
F3D9328421628D2300EA1E91 /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/Localizable.strings; sourceTree = "<group>"; };
F3EEA695234A3BE800A2FCB5 /* SnapshotHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SnapshotHelper.swift; path = ../../fastlane/SnapshotHelper.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -560,9 +556,7 @@
F3A813141F837EDD00A09AAB /* Resources */ = {
isa = PBXGroup;
children = (
F3520E73206017000011EF40 /* Strings.swift */,
F3D9328221628CF900EA1E91 /* sk */,
F3D9328121628CF000EA1E91 /* en */,
F3659D2E2B52A18000029D22 /* Localizable.xcstrings */,
);
path = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -602,22 +596,6 @@
path = Mocks;
sourceTree = "<group>";
};
F3D9328121628CF000EA1E91 /* en */ = {
isa = PBXGroup;
children = (
F3D9327E21628CDE00EA1E91 /* Localizable.strings */,
);
name = en;
sourceTree = "<group>";
};
F3D9328221628CF900EA1E91 /* sk */ = {
isa = PBXGroup;
children = (
F3D9328321628D2300EA1E91 /* Localizable.strings */,
);
name = sk;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -666,15 +644,13 @@
isa = PBXNativeTarget;
buildConfigurationList = F3A812C61F83740E00A09AAB /* Build configuration list for PBXNativeTarget "iOSSampleApp" */;
buildPhases = (
F3FEEBB621628FEA00D1CF9E /* Check strings */,
F3A812B01F83740E00A09AAB /* Sources */,
F3A812B11F83740E00A09AAB /* Frameworks */,
F3A812B21F83740E00A09AAB /* Resources */,
);
buildRules = (
);
dependencies = (
F3DFFC5E2A4C84F0001F5565 /* PBXTargetDependency */,
F32344CF29D814C000B1886D /* PBXTargetDependency */,
);
name = iOSSampleApp;
Expand Down Expand Up @@ -702,7 +678,7 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1500;
LastUpgradeCheck = 1520;
ORGANIZATIONNAME = "Igor Kulman";
TargetAttributes = {
F3208A791F84E48100B57B0E = {
Expand Down Expand Up @@ -779,9 +755,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F3D9327C21628CDE00EA1E91 /* Localizable.strings in Resources */,
F3D9328521628D2300EA1E91 /* Localizable.strings in Resources */,
F3A4B2171FC432CA00787BCE /* Licenses.plist in Resources */,
F3659D2F2B52A18000029D22 /* Localizable.xcstrings in Resources */,
F3A812C21F83740E00A09AAB /* LaunchScreen.storyboard in Resources */,
F38CD1C21F8385450050056C /* sources.json in Resources */,
F3A812BF1F83740E00A09AAB /* Assets.xcassets in Resources */,
Expand All @@ -790,26 +765,6 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
F3FEEBB621628FEA00D1CF9E /* Check strings */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"$(SRCROOT)/iOSSampleApp/Resources/Base.lproj/Localizable.strings",
"$(SRCROOT)/iOSSampleApp/Resources/sk.lproj/Localizable.strings",
);
name = "Check strings";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "${PROJECT_DIR}/../support/verify-string-files -master ${SRCROOT}/iOSSampleApp/Resources/Base.lproj/Localizable.strings\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
F3208A761F84E48100B57B0E /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -875,7 +830,6 @@
F3C5F3632962C56300257080 /* FormFieldView.swift in Sources */,
F3C5F35E2961EADD00257080 /* UIEdgeInsets+Extensions.swift in Sources */,
F38CD22F1F83A2B90050056C /* CustomSourceViewController.swift in Sources */,
F3520E74206017000011EF40 /* Strings.swift in Sources */,
F39064951F84D4D8003C0C12 /* FeedViewModel.swift in Sources */,
F38CD1CD1F8386A00050056C /* RssSourceCell.swift in Sources */,
F390649B1F84DC7A003C0C12 /* RssItem.swift in Sources */,
Expand Down Expand Up @@ -909,10 +863,6 @@
target = F3A812B31F83740E00A09AAB /* iOSSampleApp */;
targetProxy = F35BD63B2065111F000AE4E8 /* PBXContainerItemProxy */;
};
F3DFFC5E2A4C84F0001F5565 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = F3DFFC5D2A4C84F0001F5565 /* SwiftGenPlugin */;
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
Expand All @@ -924,22 +874,6 @@
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
F3D9327E21628CDE00EA1E91 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
F3D9327F21628CE200EA1E91 /* Base */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
F3D9328321628D2300EA1E91 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
F3D9328421628D2300EA1E91 /* sk */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
Expand Down Expand Up @@ -1065,6 +999,7 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -1127,6 +1062,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down Expand Up @@ -1399,11 +1335,6 @@
package = F3C71ABB2B002BB500EEAC8E /* XCRemoteSwiftPackageReference "Quick" */;
productName = Quick;
};
F3DFFC5D2A4C84F0001F5565 /* SwiftGenPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = F3DFFC5C2A4C84E2001F5565 /* XCRemoteSwiftPackageReference "SwiftGenPlugin" */;
productName = "plugin:SwiftGenPlugin";
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = F3A812AC1F83740E00A09AAB /* Project object */;
Expand Down
4 changes: 2 additions & 2 deletions Sources/iOSSampleApp/Data/Licenses.plist
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SOFTWARE.
<key>license</key>
<string>MIT License</string>
<key>text</key>
<string>Copyright (c) 2017-2018 Daltron &lt;daltonhint4@gmail.com&gt;
<string>Copyright (c) 2017-2023 Daltron &lt;daltonhint4@gmail.com&gt;

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -164,7 +164,7 @@ THE SOFTWARE.
<key>text</key>
<string>The MIT License (MIT)

Copyright (c) 2015-2023 Alexander Grebenyuk
Copyright (c) 2015-2024 Alexander Grebenyuk

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
26 changes: 0 additions & 26 deletions Sources/iOSSampleApp/Resources/Base.lproj/Localizable.strings

This file was deleted.

Loading