From dd7359f9739b650a15045b0ac2495373ec7b042d Mon Sep 17 00:00:00 2001 From: Bliss Pisit Wetcha Date: Fri, 5 Nov 2021 15:21:05 +0700 Subject: [PATCH 1/7] [#221] Add ignore file_name to extension --- {PROJECT_NAME}/Sources/Constants/Constants+API.swift | 1 + .../Sources/Supports/Extensions/UIKit/Color+Application.swift | 1 + .../Sources/Supports/Helpers/Typealiases/Typealiases.swift | 1 + 3 files changed, 3 insertions(+) diff --git a/{PROJECT_NAME}/Sources/Constants/Constants+API.swift b/{PROJECT_NAME}/Sources/Constants/Constants+API.swift index a479307d..a892479e 100644 --- a/{PROJECT_NAME}/Sources/Constants/Constants+API.swift +++ b/{PROJECT_NAME}/Sources/Constants/Constants+API.swift @@ -1,3 +1,4 @@ +// swiftlint:disable:this file_name // // Constants+API.swift // diff --git a/{PROJECT_NAME}/Sources/Supports/Extensions/UIKit/Color+Application.swift b/{PROJECT_NAME}/Sources/Supports/Extensions/UIKit/Color+Application.swift index 6ea2ad45..ead00907 100644 --- a/{PROJECT_NAME}/Sources/Supports/Extensions/UIKit/Color+Application.swift +++ b/{PROJECT_NAME}/Sources/Supports/Extensions/UIKit/Color+Application.swift @@ -1,3 +1,4 @@ +// swiftlint:disable:this file_name // // UIColor+Application.swift // diff --git a/{PROJECT_NAME}/Sources/Supports/Helpers/Typealiases/Typealiases.swift b/{PROJECT_NAME}/Sources/Supports/Helpers/Typealiases/Typealiases.swift index 42b194dc..b27d5758 100644 --- a/{PROJECT_NAME}/Sources/Supports/Helpers/Typealiases/Typealiases.swift +++ b/{PROJECT_NAME}/Sources/Supports/Helpers/Typealiases/Typealiases.swift @@ -1,3 +1,4 @@ +// swiftlint:disable:this file_name // // Typealiases.swift // From 95ad4826d658c9abd4f1ba3afc7f9048c108907b Mon Sep 17 00:00:00 2001 From: Bliss Pisit Wetcha Date: Fri, 5 Nov 2021 17:17:50 +0700 Subject: [PATCH 2/7] [#220] Use fastlane scan with build and test instead of separate build --- fastlane/Fastfile | 19 ++++--------------- fastlane/Managers/TestManager.rb | 17 +---------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5439674b..d085c9f2 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -51,19 +51,6 @@ default_platform(:ios) platform :ios do # Testing - desc 'Build for testing' - lane :build_for_testing do - test_manager.build(scheme: Constants.TESTS_SCHEME) - end - - desc 'Run tests' - lane :tests do - test_manager.test( - scheme: Constants.TESTS_SCHEME, - targets: [Constants.TESTS_TARGET, Constants.UI_TESTS_TARGET] - ) - end - desc 'Run xcov' lane :run_xcov do clear_derived_data(derived_data_path: Constants.XCOV_OUTPUT_DIRECTORY_PATH) @@ -76,8 +63,10 @@ platform :ios do desc 'Build and Test' lane :build_and_test do - build_for_testing - tests + test_manager.build_and_test( + scheme: Constants.TESTS_SCHEME, + targets: [Constants.TESTS_TARGET, Constants.UI_TESTS_TARGET] + ) end # Code Sign diff --git a/fastlane/Managers/TestManager.rb b/fastlane/Managers/TestManager.rb index 248ad3f8..229d4138 100644 --- a/fastlane/Managers/TestManager.rb +++ b/fastlane/Managers/TestManager.rb @@ -7,28 +7,13 @@ def initialize(fastlane:, device:, output_directory:) @output_directory = output_directory end - def build(scheme:) + def build_and_test(scheme:, targets:) @fastlane.scan( scheme: scheme, device: @device, output_directory: @output_directory, code_coverage: true, result_bundle: true, - build_for_testing: true, - should_zip_build_products: true, - clean: true, - fail_build: false - ) - end - - def test(scheme:, targets:) - @fastlane.scan( - scheme: scheme, - device: @device, - output_directory: @output_directory, - code_coverage: true, - result_bundle: true, - test_without_building: true, only_testing: targets, fail_build: false ) From bba09a1e17d8b913cd7dbfeba15e94337802c691 Mon Sep 17 00:00:00 2001 From: Su Ho Date: Fri, 19 Nov 2021 12:17:32 +0700 Subject: [PATCH 3/7] [#219] Add publish docs to wiki --- .github/workflows/publish_docs_to_wiki.yml | 41 ++++++++++++++++++++++ docs/Home.md | 5 +++ docs/_Footer.md | 1 + docs/_Sidebar.md | 1 + 4 files changed, 48 insertions(+) create mode 100644 .github/workflows/publish_docs_to_wiki.yml create mode 100644 docs/Home.md create mode 100644 docs/_Footer.md create mode 100644 docs/_Sidebar.md diff --git a/.github/workflows/publish_docs_to_wiki.yml b/.github/workflows/publish_docs_to_wiki.yml new file mode 100644 index 00000000..87583131 --- /dev/null +++ b/.github/workflows/publish_docs_to_wiki.yml @@ -0,0 +1,41 @@ +name: Publish docs to Wiki + +on: + push: + paths: + - docs/** + branches: + - main + +env: + USER_TOKEN: ${{ secrets.NIMBLE_DEV_TOKEN }} + USER_NAME: team-nimblehq + USER_EMAIL: dev@nimblehq.co + OWNER: ${{ github.event.repository.owner.name }} + REPOSITORY_NAME: ${{ github.event.repository.name }} + +jobs: + publish_docs_to_wiki: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Pull wiki + run: | + mkdir tmp_wiki + cd tmp_wiki + git init + git config user.name $USER_NAME + git config user.email $USER_EMAIL + git pull https://$USER_TOKEN@github.com/$OWNER/$REPOSITORY_NAME.wiki.git + + - name: Push wiki + run: | + rsync -av --delete docs/ tmp_wiki/ --exclude .git + cd tmp_wiki + git add . + git commit -m "Update Wiki content" + git push -f --set-upstream https://$USER_TOKEN@github.com/$OWNER/$REPOSITORY_NAME.wiki.git master diff --git a/docs/Home.md b/docs/Home.md new file mode 100644 index 00000000..de8a50eb --- /dev/null +++ b/docs/Home.md @@ -0,0 +1,5 @@ +## Nimble iOS Templates + +This wiki contains documentation about our optimized iOS template. + +If you want to understand our templates, let's jump into [[Getting Started]]. diff --git a/docs/_Footer.md b/docs/_Footer.md new file mode 100644 index 00000000..8a221dd1 --- /dev/null +++ b/docs/_Footer.md @@ -0,0 +1 @@ +This project is maintained and funded by Nimble. diff --git a/docs/_Sidebar.md b/docs/_Sidebar.md new file mode 100644 index 00000000..72b0ebd3 --- /dev/null +++ b/docs/_Sidebar.md @@ -0,0 +1 @@ +* [[Home]] From 5e23d03b82e2a243023afb5b14c260231fabd4a1 Mon Sep 17 00:00:00 2001 From: MarkG Date: Wed, 24 Nov 2021 11:01:50 +0700 Subject: [PATCH 4/7] [#209] Clear xcode warnings --- .swift-version | 1 + .swiftformat | 2 ++ Podfile | 1 + .../TargetAction+Initializing.swift | 5 ++--- {PROJECT_NAME}/Sources/Constants/Constants+API.swift | 2 +- {PROJECT_NAME}/Sources/Constants/Constants.swift | 2 +- .../Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift | 2 +- .../Sources/Data/NetworkAPI/Core/RequestConfiguration.swift | 2 +- {PROJECT_NAME}/Sources/Data/NetworkAPI/NetworkAPI.swift | 2 +- .../Sources/Domain/UseCases/UseCaseFactoryProtocol.swift | 2 +- .../Sources/Presentation/Navigator/Navigator+Scene.swift | 1 + .../Sources/Presentation/Navigator/Navigator.swift | 6 ++++-- 12 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 .swift-version diff --git a/.swift-version b/.swift-version new file mode 100644 index 00000000..819e07a2 --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +5.0 diff --git a/.swiftformat b/.swiftformat index 1bf106ec..c08fc24b 100644 --- a/.swiftformat +++ b/.swiftformat @@ -9,3 +9,5 @@ --disable wrapMultilineStatementBraces --disable wrapSwitchCases --disable blankLinesAtStartOfScope +--disable unusedArguments +--disable hoistPatternLet diff --git a/Podfile b/Podfile index 7c21e364..62a3b5db 100644 --- a/Podfile +++ b/Podfile @@ -1,5 +1,6 @@ platform :ios, '11.0' use_frameworks! +inhibit_all_warnings! def testing_pods pod 'Quick' diff --git a/Tuist/ProjectDescriptionHelpers/TargetAction+Initializing.swift b/Tuist/ProjectDescriptionHelpers/TargetAction+Initializing.swift index f1ebf2d2..e0d60f89 100644 --- a/Tuist/ProjectDescriptionHelpers/TargetAction+Initializing.swift +++ b/Tuist/ProjectDescriptionHelpers/TargetAction+Initializing.swift @@ -18,9 +18,8 @@ extension TargetAction { return .pre( script: "\"\(rswiftPath)\" generate \"\(outputPath)\"", name: "R.swift", - inputPaths: ["\(inputPath)"], outputPaths: ["\(outputPath)"], - basedOnDependencyAnalysis: true + basedOnDependencyAnalysis: false ) } @@ -78,7 +77,7 @@ extension TargetAction { ;; esac """ - + return .post( script: script, name: "Copy GoogleService-Info.plist", diff --git a/{PROJECT_NAME}/Sources/Constants/Constants+API.swift b/{PROJECT_NAME}/Sources/Constants/Constants+API.swift index a892479e..8c5d07ed 100644 --- a/{PROJECT_NAME}/Sources/Constants/Constants+API.swift +++ b/{PROJECT_NAME}/Sources/Constants/Constants+API.swift @@ -3,4 +3,4 @@ // Constants+API.swift // -extension Constants.API { } +extension Constants.API {} diff --git a/{PROJECT_NAME}/Sources/Constants/Constants.swift b/{PROJECT_NAME}/Sources/Constants/Constants.swift index 0d3c09b6..8a097a01 100644 --- a/{PROJECT_NAME}/Sources/Constants/Constants.swift +++ b/{PROJECT_NAME}/Sources/Constants/Constants.swift @@ -4,5 +4,5 @@ enum Constants { - enum API { } + enum API {} } diff --git a/{PROJECT_NAME}/Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift b/{PROJECT_NAME}/Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift index 05466293..c8be3e5b 100644 --- a/{PROJECT_NAME}/Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift +++ b/{PROJECT_NAME}/Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift @@ -2,9 +2,9 @@ // NetworkAPIProtocol.swift // -import RxSwift import Alamofire import RxAlamofire +import RxSwift protocol NetworkAPIProtocol { diff --git a/{PROJECT_NAME}/Sources/Data/NetworkAPI/Core/RequestConfiguration.swift b/{PROJECT_NAME}/Sources/Data/NetworkAPI/Core/RequestConfiguration.swift index 4c6998db..32ddb9d3 100644 --- a/{PROJECT_NAME}/Sources/Data/NetworkAPI/Core/RequestConfiguration.swift +++ b/{PROJECT_NAME}/Sources/Data/NetworkAPI/Core/RequestConfiguration.swift @@ -2,8 +2,8 @@ // RequestConfiguration.swift // -import Foundation import Alamofire +import Foundation protocol RequestConfiguration { diff --git a/{PROJECT_NAME}/Sources/Data/NetworkAPI/NetworkAPI.swift b/{PROJECT_NAME}/Sources/Data/NetworkAPI/NetworkAPI.swift index 666882a7..a713490e 100644 --- a/{PROJECT_NAME}/Sources/Data/NetworkAPI/NetworkAPI.swift +++ b/{PROJECT_NAME}/Sources/Data/NetworkAPI/NetworkAPI.swift @@ -2,8 +2,8 @@ // NetworkAPI.swift // -import Foundation import Alamofire +import Foundation import RxSwift final class NetworkAPI: NetworkAPIProtocol { diff --git a/{PROJECT_NAME}/Sources/Domain/UseCases/UseCaseFactoryProtocol.swift b/{PROJECT_NAME}/Sources/Domain/UseCases/UseCaseFactoryProtocol.swift index ef1ef676..9948f5ba 100644 --- a/{PROJECT_NAME}/Sources/Domain/UseCases/UseCaseFactoryProtocol.swift +++ b/{PROJECT_NAME}/Sources/Domain/UseCases/UseCaseFactoryProtocol.swift @@ -2,4 +2,4 @@ // UseCaseFactoryProtocol.swift // -protocol UseCaseFactoryProtocol: AnyObject { } +protocol UseCaseFactoryProtocol: AnyObject {} diff --git a/{PROJECT_NAME}/Sources/Presentation/Navigator/Navigator+Scene.swift b/{PROJECT_NAME}/Sources/Presentation/Navigator/Navigator+Scene.swift index f4e28905..8438f0a1 100644 --- a/{PROJECT_NAME}/Sources/Presentation/Navigator/Navigator+Scene.swift +++ b/{PROJECT_NAME}/Sources/Presentation/Navigator/Navigator+Scene.swift @@ -8,5 +8,6 @@ extension Navigator { enum Scene { // Define scene + case home } } diff --git a/{PROJECT_NAME}/Sources/Presentation/Navigator/Navigator.swift b/{PROJECT_NAME}/Sources/Presentation/Navigator/Navigator.swift index 0a28da6e..33b8c16b 100644 --- a/{PROJECT_NAME}/Sources/Presentation/Navigator/Navigator.swift +++ b/{PROJECT_NAME}/Sources/Presentation/Navigator/Navigator.swift @@ -16,8 +16,10 @@ protocol Navigatable: AnyObject { final class Navigator { private func viewController(from scene: Scene) -> UIViewController { - #warning("Create view controllers here") - return HomeViewController() + switch scene { + case .home: + return HomeViewController() + } } } From df0e3eff60b803c6ba9bd938e2e3b020d7c430c0 Mon Sep 17 00:00:00 2001 From: MarkG Date: Wed, 24 Nov 2021 14:45:30 +0700 Subject: [PATCH 5/7] [#209] Update SwiftFormat rules --- .swiftformat | 3 +-- {PROJECT_NAME}/Sources/Presentation/Navigator/Navigator.swift | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.swiftformat b/.swiftformat index c08fc24b..0ddedad7 100644 --- a/.swiftformat +++ b/.swiftformat @@ -9,5 +9,4 @@ --disable wrapMultilineStatementBraces --disable wrapSwitchCases --disable blankLinesAtStartOfScope ---disable unusedArguments ---disable hoistPatternLet +--stripunusedargs closure-only diff --git a/{PROJECT_NAME}/Sources/Presentation/Navigator/Navigator.swift b/{PROJECT_NAME}/Sources/Presentation/Navigator/Navigator.swift index 33b8c16b..8a401f42 100644 --- a/{PROJECT_NAME}/Sources/Presentation/Navigator/Navigator.swift +++ b/{PROJECT_NAME}/Sources/Presentation/Navigator/Navigator.swift @@ -27,7 +27,7 @@ extension Navigator: Navigatable { func show(scene: Scene, sender: UIViewController?, transition: Transition) { let target = viewController(from: scene) - if case .root(let window) = transition { + if case let .root(window) = transition { let snapshotOverlayView = UIScreen.main.snapshotView(afterScreenUpdates: false) target.view.addSubview(snapshotOverlayView) window?.rootViewController = target From 7c9f2ebd3c7b033b820bc1affb0a1e0af62e1475 Mon Sep 17 00:00:00 2001 From: MarkG Date: Wed, 24 Nov 2021 14:04:29 +0700 Subject: [PATCH 6/7] [#208] Fix: R.generated.swift missing --- .swiftlint.yml | 2 +- .../TargetAction+Initializing.swift | 2 +- make.sh | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index ec1acf82..efcb8a6e 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -5,7 +5,7 @@ included: excluded: - {PROJECT_NAME}Tests/Sources/Mocks/Sourcery/AutoMockable.generated.swift - - {PROJECT_NAME}/Sources/Supports/Helpers/R.swift/R.generated.swift + - {PROJECT_NAME}/Sources/Supports/Helpers/Rswift/R.generated.swift - Pods - Derived - DerivedData diff --git a/Tuist/ProjectDescriptionHelpers/TargetAction+Initializing.swift b/Tuist/ProjectDescriptionHelpers/TargetAction+Initializing.swift index e0d60f89..50a0fca2 100644 --- a/Tuist/ProjectDescriptionHelpers/TargetAction+Initializing.swift +++ b/Tuist/ProjectDescriptionHelpers/TargetAction+Initializing.swift @@ -14,7 +14,7 @@ extension TargetAction { public static func rswiftAction() -> TargetAction { let rswiftPath = "$PODS_ROOT/R.swift/rswift" let inputPath = "$TEMP_DIR/rswift-lastrun" - let outputPath = "$SRCROOT/$PROJECT_NAME/Sources/Supports/Helpers/R.swift/R.generated.swift" + let outputPath = "$SRCROOT/$PROJECT_NAME/Sources/Supports/Helpers/Rswift/R.generated.swift" return .pre( script: "\"\(rswiftPath)\" generate \"\(outputPath)\"", name: "R.swift", diff --git a/make.sh b/make.sh index fb915733..186e54a8 100644 --- a/make.sh +++ b/make.sh @@ -117,6 +117,9 @@ rename_folder "${CONSTANT_PROJECT_NAME}" "${PROJECT_NAME_NO_SPACES}" mkdir -p "${PROJECT_NAME_NO_SPACES}Tests/Sources/Mocks/Sourcery" touch "${PROJECT_NAME_NO_SPACES}Tests/Sources/Mocks/Sourcery/AutoMockable.generated.swift" +# Add R.generated.swift file +touch "${PROJECT_NAME_NO_SPACES}/Sources/Supports/Helpers/Rswift/R.generated.swift" + echo "✅ Completed" # Search and replace in files @@ -163,4 +166,4 @@ rm -rf .github/workflows/test_install_script.yml echo "✅ Completed" # Done! -echo "=> 🚀 Done! App is ready to be tested 🙌" \ No newline at end of file +echo "=> 🚀 Done! App is ready to be tested 🙌" From 19345014e6a5708b9e8254eb7d70c12311b401e8 Mon Sep 17 00:00:00 2001 From: MarkG Date: Wed, 24 Nov 2021 14:22:17 +0700 Subject: [PATCH 7/7] [#208] Update make.sh --- make.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/make.sh b/make.sh index 186e54a8..4690a5e3 100644 --- a/make.sh +++ b/make.sh @@ -118,6 +118,7 @@ mkdir -p "${PROJECT_NAME_NO_SPACES}Tests/Sources/Mocks/Sourcery" touch "${PROJECT_NAME_NO_SPACES}Tests/Sources/Mocks/Sourcery/AutoMockable.generated.swift" # Add R.generated.swift file +mkdir -p "${PROJECT_NAME_NO_SPACES}/Sources/Supports/Helpers/Rswift" touch "${PROJECT_NAME_NO_SPACES}/Sources/Supports/Helpers/Rswift/R.generated.swift" echo "✅ Completed"