Useful Xcode file templates for day to day use.
-
[Swift Test File](Swift Test File.xctemplate/XCTestCaseTabs/FILEBASENAME.swift) containing:
import XCTest
@testable import <project_name>
- Empty
setUp
andtearDown
methods - Choose between tabs or spaces
-
[Swift Nimble Test file](Swift Nimble Test File.xctemplate/XCTestCaseTabs/FILEBASENAME.swift) containing all of Swift Test File and:
- An import for Nimble
-
[Swift Snapshot Test file](Swift Snapshot Test File.xctemplate/XCTestCaseTabs/FILEBASENAME.swift) containing all of Swift Test File and:
- An import for FBSnapshotTestCase
- Test class inherits from
FBSnapshotTestCase
setUp
includerecordMode = true
-
Download/clone the repository
-
Create the templates directory if your don't have it:
mkdir -p ~/Library/Developer/Xcode/Templates/File\ Templates/Source
-
Moved the templates (
.xctemplate
folders) you find useful to the templates directory, for example:cp -r Swift\ Test\ File.xctemplate ~/Library/Developer/Xcode/Templates/File\ Templates/Source