The default generated project does not include a LaunchScreen storyboard (#1911)
* The default generated project does not include a LaunchScreen storyboard * Fix a location of LaunchScreen.stencil * Support launch screen per platform
This commit is contained in:
parent
75acfe87bf
commit
d250c5408a
|
@ -18,6 +18,8 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/
|
|||
|
||||
- Allow build phase scripts to disable dependency analysis [#1883](https://github.com/tuist/tuist/pull/1883) by [@bhuemer](https://github.com/bhuemer).
|
||||
|
||||
- The default generated project does not include a LaunchScreen storyboard [#265](https://github.com/tuist/tuist/issues/265) by [@mollyIV](https://github.com/mollyIV).
|
||||
|
||||
## 1.21.0 - PBWerk
|
||||
|
||||
### Added
|
||||
|
|
|
@ -43,7 +43,19 @@ public final class TemplateGenerator: TemplateGenerating {
|
|||
attributes.reduce(template.files) { files, attribute in
|
||||
files.map {
|
||||
let path = RelativePath($0.path.pathString.replacingOccurrences(of: "{{ \(attribute.key) }}", with: attribute.value))
|
||||
return Template.File(path: path, contents: $0.contents)
|
||||
|
||||
var contents = $0.contents
|
||||
if case let Template.Contents.file(path) = contents {
|
||||
contents = .file(
|
||||
AbsolutePath(
|
||||
path.pathString.replacingOccurrences(
|
||||
of: "{{ \(attribute.key) }}", with: attribute.value
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return Template.File(path: path, contents: contents)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11134" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
|
||||
</dependencies>
|
||||
<scenes/>
|
||||
</document>
|
||||
|
|
@ -46,7 +46,8 @@ extension Project {
|
|||
let infoPlist: [String: InfoPlist.Value] = [
|
||||
"CFBundleShortVersionString": "1.0",
|
||||
"CFBundleVersion": "1",
|
||||
{% if platform == "macOS" %}"NSMainStoryboardFile"{% else %}"UIMainStoryboardFile"{% endif %}: ""
|
||||
{% if platform == "macOS" %}"NSMainStoryboardFile"{% else %}"UIMainStoryboardFile"{% endif %}: "",
|
||||
"UILaunchStoryboardName": "LaunchScreen"
|
||||
]
|
||||
|
||||
let mainTarget = Target(
|
||||
|
@ -56,7 +57,7 @@ extension Project {
|
|||
bundleId: "io.tuist.\(name)",
|
||||
infoPlist: .extendingDefault(with: infoPlist),
|
||||
sources: ["Targets/\(name)/Sources/**"],
|
||||
resources: [],
|
||||
resources: ["Targets/\(name)/Resources/**"],
|
||||
dependencies: dependencies
|
||||
)
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ let template = Template(
|
|||
templatePath: templatePath("AppProject.stencil")),
|
||||
.file(path: appPath + "/Sources/AppDelegate.swift",
|
||||
templatePath: "AppDelegate.stencil"),
|
||||
.file(path: appPath + "/Resources/LaunchScreen.storyboard",
|
||||
templatePath: templatePath("LaunchScreen+\(platformAttribute).stencil")),
|
||||
.file(path: appPath + "/Tests/AppTests.swift",
|
||||
templatePath: templatePath("AppTests.stencil")),
|
||||
.file(path: kitFrameworkPath + "/Sources/\(nameAttribute)Kit.swift",
|
||||
|
|
|
@ -30,6 +30,8 @@ let template = Template(
|
|||
templatePath: "main.stencil"),
|
||||
.file(path: appPath + "/Sources/ContentView.swift",
|
||||
templatePath: "ContentView.stencil"),
|
||||
.file(path: appPath + "/Resources/LaunchScreen.storyboard",
|
||||
templatePath: templatePath("LaunchScreen+\(platformAttribute).stencil")),
|
||||
.file(path: appPath + "/Tests/AppTests.swift",
|
||||
templatePath: templatePath("AppTests.stencil")),
|
||||
.file(path: kitFrameworkPath + "/Sources/\(nameAttribute)Kit.swift",
|
||||
|
|
|
@ -98,19 +98,25 @@ final class TemplateGeneratorTests: TuistTestCase {
|
|||
|
||||
func test_files_are_generated_with_attributes() throws {
|
||||
// Given
|
||||
let sourcePath = try temporaryPath()
|
||||
let files = [
|
||||
Template.File(path: RelativePath("{{ name }}"), contents: .string("{{ contentName }}")),
|
||||
Template.File(path: RelativePath("{{ directoryName }}/{{ fileName }}"), contents: .string("bContent")),
|
||||
Template.File(path: RelativePath("file"), contents: .file(sourcePath.appending(component: "{{ filePath }}"))),
|
||||
]
|
||||
let template = Template.test(files: files)
|
||||
let name = "test name"
|
||||
let contentName = "test content"
|
||||
let fileContent = "test file content"
|
||||
let directoryName = "test directory"
|
||||
let fileName = "test file"
|
||||
let filePath = "test file path"
|
||||
let destinationPath = try temporaryPath()
|
||||
try FileHandler.shared.write(fileContent, path: sourcePath.appending(component: filePath), atomically: true)
|
||||
let expectedFiles: [(AbsolutePath, String)] = [
|
||||
(destinationPath.appending(component: name), contentName),
|
||||
(destinationPath.appending(components: directoryName, fileName), "bContent"),
|
||||
(destinationPath.appending(component: filePath), fileContent),
|
||||
]
|
||||
|
||||
// When
|
||||
|
@ -121,6 +127,7 @@ final class TemplateGeneratorTests: TuistTestCase {
|
|||
"contentName": contentName,
|
||||
"directoryName": directoryName,
|
||||
"fileName": fileName,
|
||||
"filePath": filePath,
|
||||
])
|
||||
|
||||
// Then
|
||||
|
|
Loading…
Reference in New Issue