This Repo contains our common project setup files.
Helpers which can be added manually to the Xcode project which should be used:
Scripts which should be called during the build phase:
Go to the the projects Build Phases
configuration, add a New Run Script Phase
called "SMF-iOS-CommonProjectSetupFiles" and place it below Compile Sources
.
The script for an app should look like:
"${SRCROOT}/Submodules/SMF-iOS-CommonProjectSetupFiles/setup-common-project-files.sh" --targettype "${PRODUCT_TYPE}"
If the App uses SwiftUI, this call should be used:
"${SRCROOT}/Submodules/SMF-iOS-CommonProjectSetupFiles/setup-common-project-files.sh" --targettype "${PRODUCT_TYPE}" --SwiftUI
If you're developing on a framework use this line on the all of your Unit Test targets:
"${SRCROOT}/Submodules/SMF-iOS-CommonProjectSetupFiles/setup-common-project-files.sh" --targettype "com.apple.product-type.framework"
This will copy the Codebeat configuration files, copy the SwiftLint configuration and for DEBUG configuration run SwiftLint. In case either of them shouldn't be used in the project a flag can be used to opt out (see the readme below).
If you want to add more parameters, eg. to disable SwiftLint, you have to add them with separate "
s. Otherwise the parameters will be interpreted as one string. Example with disabled SwiftLint:
"${SRCROOT}/Submodules/SMF-iOS-CommonProjectSetupFiles/setup-common-project-files.sh" --targettype "${PRODUCT_TYPE}" "--no-swiftlint"
This repo contains the LifetimeTracker-SDK
helper struct and SMF base view controllers. Together with a custom protocol - which duplicates the LifetimeTracker configuration without exposing any LifetimeTracker type - the base view controller and setup can be added to a project even if LifetimeTracker is not part of the project.
Multiple #if canImport(LifetimeTracker)
checks make sure that targets with LifetimeTracker are using it and that other targets work as well without any code changes.
- Add the folder
LifetimeTracker
to all targets - Call
LifetimeTrackerSDK.setup()
in the app delegate - Use the base view controllers as parent for all of your view controllers
- Use the LifetimeTracker Pod in the targets you want to
SwiftLint is integrated in SMF-iOS-CommonProjectSetupFiles itself. The current version is 0.59.1.
Make sure that /.swiftlint.yml
is added to the gitignore file as the default SwiftLint configuration file be automatically copied from the repo into the projects base folder.
The Swiftlint configuration and lint call is integrated in the setup script. If it shouldn't be used you can pass the flag --no-swiftlint
.
You can declare excluded paths in the project specific swiftlint configuration file .project-swiftlint.yml
. The file has to be placed in the same directoy as the copied .swiftlint.yml
(usually the project root directory). The scripts setup-common-project-files.sh and copy-and-run-swiftlint-config.sh are automatically using the .project-swiftlint.yml
file if it exists.
The syntax of the project specific configuration file has to match the one from the official swiftlint configuration:
excluded:
- App/HiDrive/Generated
If you want to copy the SwiftLint configuration and lint the code without integrating the setup script you can call Submodules/SMF-iOS-CommonProjectSetupFiles/SwiftLint/copy-and-run-swiftlint-config.sh
directly.
Building a project will trigger a Xcode version check to ensure you are working with the right Xcode version and an updated smf.properties
. This script will look for the Xcode version specified in smf.properties
. It will compare it to the Xcode version you are currently building the project and throw an error if it does not match.
The Xcode version check is integrated in the setup script. If it shouldn't be used you can pass the flag --no-xcodecheck
.
If you want to copy the Codebeat configuration files without integrating the setup script you can call Submodules/SMF-iOS-CommonProjectSetupFiles/Xcode/check-xcode-version.sh
directly.