Swift package to interact with Xcode Code Snippets in a type-safe manner

Overview

XCSnippets

Build

Swift package to provide type-safe interaction with (user-defined) Xcode Code Snippets

Overview

import XCSnippets

let directory = PersistentCodeSnippetDirectory() // points to ~/Library/Developer/Xcode/UserData/CodeSnippets

// CREATE (or override)
let newSnippet = XCSnippet(title: "MyFirstCodeSnippet", content: "print(\"Hello World\")")
try directory.write(contents: [newSnippet]) // alternative: try newSnippet.write(to: URL.codeSnippetsUserDirectoryURL)

// READ
let existingSnippets: [XCSnippet] = try dir.readContents()

// DELETE
try dir.delete(contents: existingSnippets) // alternative:try dir.delete(contentWithId: newSnippet.id)

Example how to copy a remote .codesnippet file to your local machine

try await URLSession.shared.data(from: URL(string: "https://raw.githubusercontent.com/burczyk/XcodeSwiftSnippets/master/swift-forin.codesnippet")!)
    .0
    .toXCSnippet()
    .write(to: .codeSnippetsUserDirectoryURL)

Note: programmatic changes in file directory ~/Library/Developer/Xcode/UserData/CodeSnippets will be ignored by a running Xcode application. You need to restart Xcode to see changes in the Snippets library.

You might also like...
Awesome-swift-platforms - A curated list of Swift on different platforms

Embedded Swift A curated list of Swift on different platforms. Nintendo Switch S

Swift package to interact with Xcode Code Snippets in a type-safe manner

XCSnippets Swift package to provide type-safe interaction with (user-defined) Xcode Code Snippets Overview import XCSnippets let directory = Persiste

XCSnippetsApp - macOS application to explore code snippets from the Swift and iOS community, view and edit the snippets before adding them conveniently to Xcode
XCSnippetsApp - macOS application to explore code snippets from the Swift and iOS community, view and edit the snippets before adding them conveniently to Xcode

XCSnippetsApp macOS application to explore code snippets from the Swift and iOS community, view and edit the snippets before adding them conveniently

Swift package for accessing SF Symbols in a type safe manner.

Swift Package Information Code Coverage Swift package for accessing SF Symbols in a type safe manner. Features ๐Ÿ’ซ Contains all SF Symbols - 1.0, 2.0,

MediaType is a library that can be used to create Media Types in a type-safe manner.

This is a general purpose Swift library for a concept of typed treatment for Media Types. We use this library on clients and servers to speak the same dialect and to enjoy all the comfort strong types provide over raw strings.

Type-safe networking abstraction layer that associates request type with response type.

APIKit APIKit is a type-safe networking abstraction layer that associates request type with response type. // SearchRepositoriesRequest conforms to Re

XcodeCodeSnippets - Code snippets for Xcode.

XcodeCodeSnippets A set of snippets for Xcode. Requirements Xcode 7.3.1 or later. Installation To install or update the snippets you need: Quit Xcode

An Xcode Plugin to upload code snippets directly into Slack and Gist
An Xcode Plugin to upload code snippets directly into Slack and Gist

XCSnippetr Share code snippets to Slack and Gist without leaving Xcode ever again! ๐Ÿ˜ฑ Features Upload code snippets using Slack's and Github's APIs. T

๐Ÿฎ A collection of Swift snippets to be used in Xcode

Swift Snippets โค๏ธ Support my app โค๏ธ Push Hero - pure Swift native macOS application to test push notifications PastePal - Pasteboard, note and shortcu

MemoryCache - type-safe, thread-safe memory cache class in Swift

MemoryCache is a memory cache class in swift. The MemoryCache class incorporates LRU policies, which ensure that a cache doesnโ€™t

Modern thread-safe and type-safe key-value observing for Swift and Objective-C

Now Archived and Forked PMKVObserver will not be maintained in this repository going forward. Please use, create issues on, and make PRs to the fork o

A Protocol-Oriented NotificationCenter which is type safe, thread safe and with memory safety
A Protocol-Oriented NotificationCenter which is type safe, thread safe and with memory safety

A Protocol-Oriented NotificationCenter which is type safe, thread safe and with memory safety. Type Safe No more userInfo dictionary and Downcasting,

Type-safe CAAnimation wrapper. It makes preventing to set wrong type values.
Type-safe CAAnimation wrapper. It makes preventing to set wrong type values.

TheAnimation TheAnimation is Type-safe CAAnimation wrapper. Introduction For example, if you want to animate backgroundColor with CABasicAnimation, yo

Some helpful swift code snippets

HelpfulSwiftSnippets Some helpful swift code snippets Network Manager - a generic network manager that deals with downloading data from the internet u

SnippetsLibrary - Code snippets library for SwiftUI Devs.
SnippetsLibrary - Code snippets library for SwiftUI Devs.

SnippetsLibrary is a helpful tool for SwiftUI developers to help with their daily coding life. SnippetsLibrary contains all the needed code snippets for you to view, edit, or add more and more. This will make your daily work easier and faster.

AwaitKit is a powerful Swift library which provides a powerful way to write asynchronous code in a sequential manner.
AwaitKit is a powerful Swift library which provides a powerful way to write asynchronous code in a sequential manner.

AwaitKit is a powerful Swift library inspired by the Async/Await specification in ES8 (ECMAScript 2017) which provides a powerful way to write asynchronous code in a sequential manner.

๐Ÿš€ Create, maintain, and interact with Xcode projects at scale
๐Ÿš€ Create, maintain, and interact with Xcode projects at scale

What's Tuist ๐Ÿ•บ Tuist is a command line tool that helps you generate, maintain and interact with Xcode projects. It's open source and written in Swift

SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them type-safe to use.
SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them type-safe to use.

SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them type-safe to use.

Releases(1.1.0)
  • 1.1.0(Jun 15, 2022)

    โš  BREAKING CHANGES

    โœ๏ธ Renamed package and its product from XCodeSnippets to XCSnippets โœ๏ธ Renamed structs XCodeSnippets / XCodeSnippet accordingly to XCSnippets / XCSnippet

    Features

    ๐ŸŽธ XCSnippet conforms to Identifiable and Hashable

    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Jun 12, 2022)

    Adding new public extension to XCodeSnippet on Data

    Example how to copy a remote .codesnippet file to your local machine

    try await URLSession.shared.data(from: URL(string: "https://raw.githubusercontent.com/burczyk/XcodeSwiftSnippets/master/swift-forin.codesnippet")!)
        .0
        .toXCodeSnippet()
        .write(to: .codeSnippetsUserDirectoryURL)
    
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Jun 12, 2022)

Owner
Marco Eidinger
Software engineer working on open source and enterprise mobile SDKs for iOS and MacOS developers written in Swift
Marco Eidinger
XcodeCodeSnippets - Code snippets for Xcode.

XcodeCodeSnippets A set of snippets for Xcode. Requirements Xcode 7.3.1 or later. Installation To install or update the snippets you need: Quit Xcode

Ivan Smetanin 32 Aug 28, 2022
Awesome-xcode-scripts - A curated list of useful xcode scripts ๐Ÿ“ .

Awesome Xcode Scripts A curated list of useful Xcode scripts ?? . Content How to Setup Scripts Build Number Auto-Increment Script Build Number Auto-In

Aashish Tamsya 108 Aug 22, 2022
Synx - A command-line tool that reorganizes your Xcode project folder to match your Xcode groups

A command-line tool that reorganizes your Xcode project folder to match your Xcode groups. Xcode Finder Installation $ gem install synx Usage Basic โš 

Venmo 6.1k Sep 15, 2022
CodeEditTextView - An Xcode-inspired code editor view written in Swift powered by tree-sitter for CodeEdit

An Xcode-inspired code editor view written in Swift powered by tree-sitter for CodeEdit. Features include syntax highlighting (based

CodeEdit 150 Sep 24, 2022
Swift-VIPER-Module - Xcode template for VIPER Architecture written in Swift 4

โš ๏ธ Deprecated โš ๏ธ This library is deprecated. When you decide to use VIPER architecture in your project, it is very tired create new modules, because y

Juanpe Catalรกn 535 Aug 16, 2022
ViperC - Xcode template for VIPER Architecture for both Objective-C and Swift.

ViperC Xcode template for VIPER Architecture for both Objective-C and Swift. ViperC creates modules for you when you want to use VIPER architecture in

Abdullah Selek 78 May 16, 2022
VIPERModuleTemplate - Template of VIPER Module for Xcode

Once you've decided to use a VIPER architecture in your app, you should know about the routine. For each screen/module you should create at least 6 fi

Bogdan Evsenev 17 Dec 10, 2021
Xcode-developer-disk-image-all-platforms - A repo which shares all developer disk images for iOS, tvOS, watchOS

Disclaimer: The available resources and files from this repo are uploaded from many contributors. The files are unverified, untested, and could have n

Hai K 242 Sep 14, 2022
Awesome-gitignore-templates - A curated collection of useful gitignore templates for different programming languages while pushing your code to git. ๐Ÿ˜Š ๐Ÿ“

Awesome Gitignore Templates A curated collection of useful gitignore templates for different programming languages while pushing your code to git. ??

Aashish Tamsya 19 Jun 11, 2022
Swift-project-template - ๐Ÿช Easily generate Swift projects with Cookiecutter

swift-project-template ?? Cookiecutter template for Swift iOS projects. Features: Xcode 11 and Swift 5.0 support AppCode support Custom project struct

Artem Novichkov 86 Jul 8, 2022