Skip to content

Instantly share code, notes, and snippets.

@dheerajn
Last active September 19, 2021 19:22
Show Gist options
  • Save dheerajn/b52e354dfbdc1653623dd25f6c39912d to your computer and use it in GitHub Desktop.
Save dheerajn/b52e354dfbdc1653623dd25f6c39912d to your computer and use it in GitHub Desktop.
@main
struct SwiftUI_UITesting_MediumApp: App {
init() {
loadEnvironmentRelatedServices()
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
private func loadEnvironmentRelatedServices() {
processLaunchArguments()
}
private func processLaunchArguments() {
var arguments = ProcessInfo.processInfo.arguments
arguments.removeFirst() // First argument is thec path
processCustomLaunchArguments(arguments)
}
private func processCustomLaunchArguments(_ arguments: [String]) {
arguments.forEach {
switch $0 {
case "NoAnimations":
UIView.setAnimationsEnabled(false)
default:
print("arguments should be handled")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment