From f0e1db79e062fd116954276060b9e39dace26dad Mon Sep 17 00:00:00 2001 From: Roman Aliyev Date: Sun, 24 Sep 2023 17:22:56 +0200 Subject: [PATCH] added examples of production-ready manifests for common tasks. --- Docs/Recipes/ios-alternate-app-icons.md | 53 +++++++++++++++ Docs/Recipes/ios-environments.md | 72 ++++++++++++++++++++ Docs/Recipes/ios-playground.md | 90 +++++++++++++++++++++++++ Docs/Recipes/ios-ui-testing-bundle.md | 58 ++++++++++++++++ Docs/Recipes/ios-unit-testing-bundle.md | 58 ++++++++++++++++ 5 files changed, 331 insertions(+) create mode 100644 Docs/Recipes/ios-alternate-app-icons.md create mode 100644 Docs/Recipes/ios-environments.md create mode 100644 Docs/Recipes/ios-playground.md create mode 100644 Docs/Recipes/ios-ui-testing-bundle.md create mode 100644 Docs/Recipes/ios-unit-testing-bundle.md diff --git a/Docs/Recipes/ios-alternate-app-icons.md b/Docs/Recipes/ios-alternate-app-icons.md new file mode 100644 index 00000000..c6b550a0 --- /dev/null +++ b/Docs/Recipes/ios-alternate-app-icons.md @@ -0,0 +1,53 @@ +# (iOS) Alternate app icons + + +## Description + +Adds alternate app icons to include in the built product. + +## File structure + +```diff + . + ├── MyApp + │   ├── AppDelegate.swift + │   ├── Assets.xcassets + │   │   ├── AppIcon.appiconset + │   │   │   ├── AppIcon.png + | | | └── Contents.json ++│   │   ├── AppIcon2.appiconset ++│   │   │   ├── AppIcon.png ++| | | └── Contents.json ++│   │   ├── AppIcon3.appiconset ++│   │   │   ├── AppIcon.png ++| | | └── Contents.json + │   │   └── Contents.json + │   ├── LaunchScreen.storyboard + │   └── RootViewController.swift + └── project.yml +``` + +## project.yml + +```diff + name: MyApp + targets: + MyApp: + type: application + platform: iOS + deploymentTarget: 12.0 + settings: + TARGETED_DEVICE_FAMILY: 1 + MARKETING_VERSION: 1.0 + CURRENT_PROJECT_VERSION: 1 + DEVELOPMENT_TEAM: MYTEAMID + PRODUCT_BUNDLE_IDENTIFIER: com.mycompany.myapp + GENERATE_INFOPLIST_FILE: YES + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents: YES + INFOPLIST_KEY_UILaunchStoryboardName: LaunchScreen.storyboard + INFOPLIST_KEY_UISupportedInterfaceOrientations: UIInterfaceOrientationPortrait ++ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS: YES ++ ASSETCATALOG_COMPILER_ALTERNATE_APPICON_NAMES: AppIcon2 AppIcon3 + sources: + - MyApp +``` diff --git a/Docs/Recipes/ios-environments.md b/Docs/Recipes/ios-environments.md new file mode 100644 index 00000000..350db7f9 --- /dev/null +++ b/Docs/Recipes/ios-environments.md @@ -0,0 +1,72 @@ +# (iOS) Environments + + +## Description + +Best way to setup Development, Testing and Production environments. + +## File structure + +```diff + . + ├── MyApp + │   ├── AppDelegate.swift + │   ├── Assets.xcassets + │   │   ├── AppIcon.appiconset + │   │   │   ├── AppIcon.png + | | | └── Contents.json + │   │   └── Contents.json + │   ├── LaunchScreen.storyboard + │   └── RootViewController.swift + └── project.yml +``` + +## project.yml + +```diff + name: MyApp ++configs: ++ Dev Debug: debug ++ Test Debug: debug ++ Prod Debug: debug ++ Dev Release: release ++ Test Release: release ++ Prod Release: release ++settings: ++ configs: ++ Dev Debug: ++ SWIFT_ACTIVE_COMPILATION_CONDITIONS: DEBUG DEV ++ Test Debug: ++ SWIFT_ACTIVE_COMPILATION_CONDITIONS: DEBUG TEST ++ Prod Debug: ++ SWIFT_ACTIVE_COMPILATION_CONDITIONS: DEBUG PROD ++ Dev Release: ++ SWIFT_ACTIVE_COMPILATION_CONDITIONS: DEV ++ Test Release: ++ SWIFT_ACTIVE_COMPILATION_CONDITIONS: TEST ++ Prod Release: ++ SWIFT_ACTIVE_COMPILATION_CONDITIONS: PROD + targets: + MyApp: + type: application + platform: iOS + deploymentTarget: 12.0 + settings: + TARGETED_DEVICE_FAMILY: 1 + MARKETING_VERSION: 1.0 + CURRENT_PROJECT_VERSION: 1 + DEVELOPMENT_TEAM: MYTEAMID + PRODUCT_BUNDLE_IDENTIFIER: com.mycompany.myapp + GENERATE_INFOPLIST_FILE: YES + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents: YES + INFOPLIST_KEY_UILaunchStoryboardName: LaunchScreen.storyboard + INFOPLIST_KEY_UISupportedInterfaceOrientations: UIInterfaceOrientationPortrait + sources: + - MyApp ++ scheme: ++ configVariants: ++ - Dev ++ - Test ++ - Prod +``` + diff --git a/Docs/Recipes/ios-playground.md b/Docs/Recipes/ios-playground.md new file mode 100644 index 00000000..2e20839e --- /dev/null +++ b/Docs/Recipes/ios-playground.md @@ -0,0 +1,90 @@ +# (iOS) Playground + + +## Description + +An alternative to XCode Playground. + +Example of Source.swift: + +```swift +import UIKit + +@main +class AppDelegate: UIResponder, UIApplicationDelegate { + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + var greeting = "Hello, playground" + print(greeting) + + return true + } +} +``` + +Another example with UI: + +```swift +import UIKit + +@main +class AppDelegate: UIResponder, UIApplicationDelegate { + var window: UIWindow? + + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + let window = UIWindow() + self.window = window + + let rootViewController = RootViewController(nibName: nil, bundle: nil) + window.rootViewController = rootViewController + window.makeKeyAndVisible() + + return true + } +} + +class RootViewController: UIViewController { + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view. + } +} +``` + + +## File structure + +```diff +. +├── Source.swift +└── project.yml +``` + +## project.yml + +```diff + name: MyApp + targets: + MyApp: + type: application + platform: iOS + deploymentTarget: 12.0 + settings: + TARGETED_DEVICE_FAMILY: 1 + MARKETING_VERSION: 1.0 + CURRENT_PROJECT_VERSION: 1 + DEVELOPMENT_TEAM: MYTEAMID + PRODUCT_BUNDLE_IDENTIFIER: com.mycompany.myapp + GENERATE_INFOPLIST_FILE: YES + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents: YES +- INFOPLIST_KEY_UILaunchStoryboardName: LaunchScreen.storyboard ++ INFOPLIST_KEY_UILaunchScreen_Generation: YES + INFOPLIST_KEY_UISupportedInterfaceOrientations: UIInterfaceOrientationPortrait + sources: + - Source.swift +``` diff --git a/Docs/Recipes/ios-ui-testing-bundle.md b/Docs/Recipes/ios-ui-testing-bundle.md new file mode 100644 index 00000000..a9f595ac --- /dev/null +++ b/Docs/Recipes/ios-ui-testing-bundle.md @@ -0,0 +1,58 @@ +# (iOS) UI Testing Bundle + + +## Description + +Adds a user interface testing bundle that uses the XCTest framework. + +## File structure + +```diff + . + ├── MyApp + │   ├── AppDelegate.swift + │   ├── Assets.xcassets + │   │   ├── AppIcon.appiconset + │   │   │   ├── AppIcon.png + | | | └── Contents.json + │   │   └── Contents.json + │   ├── LaunchScreen.storyboard + │   └── RootViewController.swift ++├── MyAppUITests ++│   └── SomeUITests.swift + └── project.yml +``` + +## project.yml + +```diff + name: MyApp + targets: + MyApp: + type: application + platform: iOS + deploymentTarget: 12.0 + settings: + TARGETED_DEVICE_FAMILY: 1 + MARKETING_VERSION: 1.0 + CURRENT_PROJECT_VERSION: 1 + DEVELOPMENT_TEAM: MYTEAMID + PRODUCT_BUNDLE_IDENTIFIER: com.mycompany.myapp + GENERATE_INFOPLIST_FILE: YES + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents: YES + INFOPLIST_KEY_UILaunchStoryboardName: LaunchScreen.storyboard + INFOPLIST_KEY_UISupportedInterfaceOrientations: UIInterfaceOrientationPortrait + sources: + - MyApp ++ MyAppUITests: ++ type: bundle.ui-testing ++ platform: iOS ++ settings: ++ DEVELOPMENT_TEAM: MYTEAMID ++ PRODUCT_BUNDLE_IDENTIFIER: com.company.myappuitests ++ GENERATE_INFOPLIST_FILE: YES ++ sources: ++ - MyAppUITests ++ dependencies: ++ - target: MyApp +``` diff --git a/Docs/Recipes/ios-unit-testing-bundle.md b/Docs/Recipes/ios-unit-testing-bundle.md new file mode 100644 index 00000000..bb576e11 --- /dev/null +++ b/Docs/Recipes/ios-unit-testing-bundle.md @@ -0,0 +1,58 @@ +# (iOS) Unit Testing Bundle + + +## Description + +Adds a unit test bundle that uses the XCTest framework. + +## File structure + +```diff + . + ├── MyApp + │   ├── AppDelegate.swift + │   ├── Assets.xcassets + │   │   ├── AppIcon.appiconset + │   │   │   ├── AppIcon.png + | | | └── Contents.json + │   │   └── Contents.json + │   ├── LaunchScreen.storyboard + │   └── RootViewController.swift ++├── MyAppTests ++│   └── SomeTests.swift + └── project.yml +``` + +## project.yml + +```diff + name: MyApp + targets: + MyApp: + type: application + platform: iOS + deploymentTarget: 12.0 + settings: + TARGETED_DEVICE_FAMILY: 1 + MARKETING_VERSION: 1.0 + CURRENT_PROJECT_VERSION: 1 + DEVELOPMENT_TEAM: MYTEAMID + PRODUCT_BUNDLE_IDENTIFIER: com.mycompany.myapp + GENERATE_INFOPLIST_FILE: YES + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents: YES + INFOPLIST_KEY_UILaunchStoryboardName: LaunchScreen.storyboard + INFOPLIST_KEY_UISupportedInterfaceOrientations: UIInterfaceOrientationPortrait + sources: + - MyApp ++ MyAppTests: ++ type: bundle.unit-test ++ platform: iOS ++ settings: ++ DEVELOPMENT_TEAM: MYTEAMID ++ PRODUCT_BUNDLE_IDENTIFIER: com.company.myapptests ++ GENERATE_INFOPLIST_FILE: YES ++ sources: ++ - MyAppTests ++ dependencies: ++ - target: MyApp +```