TCA View の xctemplate
以下のファイルを ~/Library/Developer/Xcode/Templates/File Templates/Source/TCA View.xctemplate/
に作る。
___FILEBASENAME___.swift
の中身
//___FILEHEADER___
import ComposableArchitecture
import SwiftUI
public struct ___FILEBASENAME___: View {
let store: StoreOf<<#Reducer#>>
public init(store: StoreOf<<#Reducer#>>) {
self.store = store
}
public var body: some View {
Text("Hello world")
}
}
#Preview {
___FILEBASENAME___(
store: .init(initialState: .init()) {
<#Reducer#>()
}
)
}
TemplateInfo.plist
の中身
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SupportsSwiftPackage</key>
<true/>
<key>Kind</key>
<string>Xcode.IDEFoundation.TextSubstitutionFileTemplateKind</string>
<key>Description</key>
<string>An empty SwiftUI View file for TCA.</string>
<key>Summary</key>
<string>TCA SwiftUI View file.</string>
<key>SortOrder</key>
<string>1</string>
<key>Image</key>
<dict>
<key>FileTypeIcon</key>
<string>swift</string>
</dict>
<key>AllowedTypes</key>
<array>
<string>public.swift-source</string>
</array>
<key>Platforms</key>
<array />
<key>DefaultCompletionName</key>
<string>File</string>
<key>MainTemplateFile</key>
<string>___FILEBASENAME___.swift</string>
<key>Options</key>
<array>
<dict>
<key>Identifier</key>
<string>productName</string>
<key>Required</key>
<true/>
<key>Name</key>
<string>Name:</string>
<key>Description</key>
<string>The name of the file to create</string>
<key>Type</key>
<string>text</string>
<key>NotPersisted</key>
<true/>
</dict>
</array>
</dict>
</plist>