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

[Documentation] Recipes #1404

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
53 changes: 53 additions & 0 deletions Docs/Recipes/ios-alternate-app-icons.md
Original file line number Diff line number Diff line change
@@ -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
```
72 changes: 72 additions & 0 deletions Docs/Recipes/ios-environments.md
Original file line number Diff line number Diff line change
@@ -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
```

90 changes: 90 additions & 0 deletions Docs/Recipes/ios-playground.md
Original file line number Diff line number Diff line change
@@ -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
```
58 changes: 58 additions & 0 deletions Docs/Recipes/ios-ui-testing-bundle.md
Original file line number Diff line number Diff line change
@@ -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
```
58 changes: 58 additions & 0 deletions Docs/Recipes/ios-unit-testing-bundle.md
Original file line number Diff line number Diff line change
@@ -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
```