{"id":18799111,"url":"https://github.com/marcoeidinger/xcsnippets","last_synced_at":"2026-01-24T03:05:22.684Z","repository":{"id":63917132,"uuid":"502403092","full_name":"MarcoEidinger/XCSnippets","owner":"MarcoEidinger","description":"Swift package to interact with Xcode Code Snippets in a type-safe manner","archived":false,"fork":false,"pushed_at":"2022-06-16T12:45:20.000Z","size":31,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-13T21:32:39.074Z","etag":null,"topics":["codesnippets","swiftpackage","xcode"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MarcoEidinger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-11T16:41:16.000Z","updated_at":"2022-10-11T10:55:30.000Z","dependencies_parsed_at":"2023-01-14T13:45:53.352Z","dependency_job_id":null,"html_url":"https://github.com/MarcoEidinger/XCSnippets","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcoEidinger%2FXCSnippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcoEidinger%2FXCSnippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcoEidinger%2FXCSnippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcoEidinger%2FXCSnippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarcoEidinger","download_url":"https://codeload.github.com/MarcoEidinger/XCSnippets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223596994,"owners_count":17170872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codesnippets","swiftpackage","xcode"],"created_at":"2024-11-07T22:14:07.658Z","updated_at":"2026-01-24T03:05:22.655Z","avatar_url":"https://github.com/MarcoEidinger.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XCSnippets\n\n[![Build](https://github.com/MarcoEidinger/XCSnippets/actions/workflows/swift.yml/badge.svg)](https://github.com/MarcoEidinger/XCSnippets/actions/workflows/swift.yml)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FMarcoEidinger%2FXCSnippets%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/MarcoEidinger/XCSnippets)\n[![](https://img.shields.io/badge/Documentation-DocC-blue)](https://swiftpackageindex.com/MarcoEidinger/XCSnippets/main/documentation/xcsnippets)\n\nSwift package to provide type-safe interaction with (user-defined) Xcode Code Snippets\n\n## Overview\n\n```swift\nimport XCSnippets\n\nlet directory = PersistentCodeSnippetDirectory() // points to ~/Library/Developer/Xcode/UserData/CodeSnippets\n\n// CREATE (or override)\nlet newSnippet = XCSnippet(title: \"MyFirstCodeSnippet\", content: \"print(\\\"Hello World\\\")\")\ntry directory.write(contents: [newSnippet]) // alternative: try newSnippet.write(to: URL.codeSnippetsUserDirectoryURL)\n\n// READ\nlet existingSnippets: [XCSnippet] = try dir.readContents()\n\n// DELETE\ntry dir.delete(contents: existingSnippets) // alternative:try dir.delete(contentWithId: newSnippet.id)\n```\n\nExample how to copy a remote `.codesnippet` file to your local machine\n\n```swift\ntry await URLSession.shared.data(from: URL(string: \"https://raw.githubusercontent.com/burczyk/XcodeSwiftSnippets/master/swift-forin.codesnippet\")!)\n    .0\n    .toXCSnippet()\n    .write(to: .codeSnippetsUserDirectoryURL)\n```\n\n**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. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcoeidinger%2Fxcsnippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcoeidinger%2Fxcsnippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcoeidinger%2Fxcsnippets/lists"}