Its’ really easy.
- Hop over to
/Applications/Xcode6-Beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File Templates/Source - Copy Playground.xctemplate to your desktop. Rename it to MyPlayground.xctemplate or something similar but unique This name is shown in the new file dialog.
- If the folder does not yet exist, create /Users/ericasadun/Library/Developer/Xcode/Templates/File Templates/Playgrounds
- Move the new template into the File Templates/Playgrounds folder in your home library
- In the .template folder edit the two icon files (if desired) to give them a visual distinction
- If desired, edit the TemplateInfo.plist file and update the DefaultCompletionName to the standard file name you want to be offered to save to
- Select ___FILEBASENAME___.playground. Right-click it and choose Show Package Contents.
- Edit section-1.swift however you like. My version now imports Foundation and provides a couple of convenient functions:
// My Custom Playground // Created by ___FULLUSERNAME___ on ___DATE___ import UIKit import Foundation func Peek(object : AnyObject?) { println(object ? "\(object)" : "<nil>") } func Peek(label: String, object : AnyObject?) { println(object ? "\(label) \(object)" : "\(label) <nil>") }
And that’s about all there is to it. I find this a lot less trouble now than constantly pulling in snippets.
Comments are closed.