मैं Generamba
से परिचित नहीं हूँ, लेकिन Xcode
सामान्य रूप में अपने टेम्पलेट को पहचानते हैं:
नामक फ़ोल्डर MyTemplate.xctemplate
Xcode बता कुछ में अपने Template.swift
फ़ाइल डाल Templateinfo.plist
MyTemplate.xctemplate
(नीचे उदाहरण पाएं) जोड़ कर अपने टेम्पलेट के बारे में विवरण।
MyTemplate.xctemplate
~/Library/Developer/Xcode/Templates/File\ Templates/Custom
पर प्रतिलिपि बनाएँ।
ऐसा करने के बाद, टेम्पलेट्स Xcode
रों new File
टेम्पलेट चयन मेनू के तल पर दिखाई देते हैं।
उदाहरण:
आप पर्यावरण चर प्लेसहोल्डर कि Xcode
द्वारा प्रतिस्थापित करने के लिए उपयोग कर सकते।
यहाँ एक सरल उदाहरण टेम्पलेट Worker.swift
कहा जाता है:
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
//
// This file was generated. DO NOT MODIFY !
//
import Foundation
class ___FILEBASENAMEASIDENTIFIER___Worker {
//implementation goes here
}
और इसकी उदाहरण 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>DefaultCompletionName</key>
<string>MyWorker</string>
<key>Description</key>
<string>This generates a new worker.</string>
<key>Kind</key>
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
<key>Options</key>
<array>
<dict>
<key>Default</key>
<string>___VARIABLE_sceneName:identifier___Worker</string>
<key>Description</key>
<string>The worker name</string>
<key>Identifier</key>
<string>workerName</string>
<key>Name</key>
<string>Worker Name:</string>
<key>Required</key>
<true/>
<key>Type</key>
<string>static</string>
</dict>
</array>
<key>Platforms</key>
<array>
<string>com.apple.platform.iphoneos</string>
</array>
<key>SortOrder</key>
<string>4</string>
<key>Summary</key>
<string>Summery</string>
</dict>
तुम भी Xcode बनाने बनाने के लिए अपने MyTemplate.xctemplate
निर्देशिका के भीतर एक से अधिक फ़ाइलों जगह कर सकते हैं एक साथ कई फाइलें। अपने VIPER
टेम्पलेट्स के लिए, आप Xcode को एक बार में पूरे VIPER
दृश्य बना सकते हैं।
आप काम कर रहे उदाहरण प्लस makefile
in this "Clean Swift" template repo (स्वच्छ स्विफ्ट स्विफ्ट के लिए अभी तक एक और स्वच्छ आर्किटेक्चर दृष्टिकोण है)।
कूल !! धन्यवाद –