A collection of Xcode snippets that I use every day.
Download and copy any or all of the code snippet files into your ~/Library/Developer/Xcode/UserData/CodeSnippets
directory.
File | Title | Summary | Prefix |
---|---|---|---|
CodingKeys | CodingKeys | enum CodingKey | ck |
ColorLiteral | Color Literal | A Swift color literal | clr |
Combine-Cancellables | cancellables | Combine set of cancellables | canc |
[Countries and currencies](https://github.com/markiv/SwiftUI-Xcode-Snippets/blob/main/Countries and currencies.codesnippet) | Countries and Currencies | Arrays of placeholder data | coun |
EmojiFlag | emojiFlag | String extension for Unicode flags | emojiFlag |
[Lorem Ipsum](https://github.com/markiv/SwiftUI-Xcode-Snippets/blob/main/Lorem Ipsum.codesnippet) | Lorem Ipsum | A paragraph of placeholder text | lorem |
MARK | MARK | MARK: - Code separator | mk |
PrintFunction | Print Function | Prints the current function name, file and line number | pf |
PublishedProperty | Published Property | A Combine Published property | pbl |
Swift-AsyncAfter | Async After | Perform a closure after a time interval | after |
Swift-IfDebug | #if DEBUG | #if DEBUG compiler directive | ifd |
Swift-IfSimulator | #if Simulator | #if target is Simulator compiler directive | ifs |
Swift-return | return something | A return statement | rt |
SwiftUI-Button | SwiftUI Button | A SwiftUI Button with label | but |
SwiftUI-Environment | SwiftUI Environment | A SwiftUI Environment variable | env |
SwiftUI-ForEachIndexedCollection | SwiftUI ForEach over indexed collection | SwiftUI ForEach over an indexed collection | fori |
SwiftUI-FrameInfinity | Frame Infinity | Add a frame of infinite size | inf |
SwiftUI-LargestPreferenceKey | SwiftUI Gather Largest Size with PreferenceKey | SwiftUI: Gather the largest size unsing PreferenceKey | lpk |
SwiftUI-List1000 | List 1000 | A List of 1000 simple items | l1 |
SwiftUI-LongText | SwiftUI Long Text | A SwiftUI Text view with a long placeholder text | tlorem |
SwiftUI-Preview | SwiftUI Preview | A SwiftUI Preview | spv |
SwiftUI-PrintChanges | Print Changes | Print changes in a SwiftUI view | pc |
SwiftUI-RandomOnlineImage | Random Online Image | A random online image from picsum | rndimg |
SwiftUI-SampleList | SwiftUI List sample items | A SwiftUI List with sample items (currency names) | items |
SwiftUI-StateVariable | SwiftUI State Variable | A SwiftUI @State variable | stt |
SwiftUI-SwiftLogo | Swift Logo | The Swift logo as a placeholder view | swl |
SwiftUI-SystemImage | SwiftUI System Image | SwiftUI Image with an SF Symbol | ims |
SwiftUI-Text | SwiftUI Text | SwiftUI Text with placeholder | txt |
SwiftUI-TextWithExpression | SwiftUI Text with interpolated string expression | SwiftUI Text with interpolated string expression | sti |
SwiftUI-UIViewControllerRepresentable | SwiftUI View Controller Representable | Template for when you want to wrap a UIKit View Controller into a SwiftUI View | svcr |
SwiftUI-UIViewRepresentable | SwiftUI UIViewRepresentable | Template for when you want to wrap a UIKit View into a SwiftUI View | svr |
SwiftUI-View | SwiftUI View | Just a SwiftUI View with a placeholder body | sv |
SwiftUI-ViewBuilderVar | ViewBuilder var | A @ViewBuilder variable | vbv |
SwiftUI-ViewModel | SwiftUI ViewModel class | SwiftUI ViewModel class | vmo |
SwiftUI-ViewModifier | SwiftUI View Modifier | A SwiftUI View Modifier | vm |
SwiftUI-ViewWithModel | SwiftUI View with ViewModel | svm |
|
SwiftUI-WebView | WebView | A WKWebView wrapped into a UIViewRepresentable | wv |
SwiftUI-WrappedUIView | Wrapped UIView | A template for any wrapped UIView | uv |
[URL by String Literal](https://github.com/markiv/SwiftUI-Xcode-Snippets/blob/main/URL by String Literal.codesnippet) | URL by String Literal | URL extension to make URLs expressible by string literals | uxs |