Skip to content

An elegant macOS code snippets management app that helps you organize and save your frequently used code snippets.

Notifications You must be signed in to change notification settings

wangqiyangX/SwiftSnippets

Repository files navigation

Swift Snippets

Screenshot 1

An elegant macOS code snippets management app that helps you organize and save your frequently used code snippets.

✨ Features

  • 📁 Folder Management - Organize code snippets with folders to keep everything tidy and organized
  • 💾 Persistent Storage - SwiftData-based data persistence for secure and reliable data storage
  • 🎨 Code Editor - Integrated CodeEditSourceEditor for a professional code editing experience
  • 🌈 Syntax Highlighting - Syntax highlighting support for multiple programming languages
  • 🎯 Multi-language Support - Support for Swift, Python, JavaScript, TypeScript, and many other programming languages
  • 🌓 Theme Switching - Support for dark and light themes, automatically follows system settings
  • 📝 Detailed Information - Add titles and descriptions to each code snippet
  • 🔍 Convenient Operations - Support for swipe-to-delete, quick add, and other convenient operations

🛠 Tech Stack

  • SwiftUI - Modern user interface framework
  • SwiftData - Data persistence framework
  • CodeEditSourceEditor - Professional code editor component

📋 System Requirements

  • macOS 14.0 or later
  • Xcode 15.0 or later
  • Swift 5.9 or later

🚀 Installation and Usage

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/SwiftSnippets.git
cd SwiftSnippets
  1. Open the project in Xcode:
open SwiftSnippets.xcodeproj
  1. Build and run the project (⌘R)

Usage

  1. Create Folder: Click the "Add Folder" button in the toolbar to create a new folder
  2. Add Snippet: Select a folder and click the "Add Snippet" button to add a new code snippet
  3. Edit Code: Click on a code snippet to enter the editing interface and write code using the professional code editor
  4. Set Language: Use the language picker in the editing interface to switch programming languages
  5. Edit Information: Double-click the title or click the "Show Inspector" button to edit the title and description
  6. Delete Item: Swipe left on a list item and click the delete button

📁 Project Structure

SwiftSnippets/
├── SwiftSnippets/
│   ├── Models/              # Data models
│   │   ├── Folder.swift    # Folder model
│   │   └── Snippet.swift   # Snippet model
│   ├── Views/              # View components
│   │   ├── ContentView.swift          # Main view
│   │   ├── SnippetDetailView.swift    # Snippet detail view
│   │   ├── AddFolderSheet.swift       # Add folder sheet
│   │   └── LanguagePicker.swift       # Language picker
│   ├── Extensions/         # Extensions
│   │   └── EditorTheme+Default.swift  # Editor theme extension
│   ├── Assets.xcassets/    # Asset files
│   ├── SwiftSnippetsApp.swift         # App entry point
│   └── Info.plist          # App configuration
├── SwiftSnippetsTests/     # Unit tests
├── SwiftSnippetsUITests/   # UI tests
└── Screenshots/            # Screenshots

🎯 Core Features

Data Models

  • Folder: Contains name and list of code snippets, supports cascade deletion
  • Snippet: Contains title, description, code content, programming language, and parent folder

Editor Features

  • Syntax highlighting
  • Code folding
  • Line number display
  • Cursor position display
  • Auto-indentation
  • Code formatting
  • Configurable editor options (line wrapping, indentation, font, etc.)

🤝 Contributing

Contributions are welcome! Please feel free to submit an Issue or Pull Request.

📄 License

This project is licensed under the MIT License.

👤 Author

Created by wangqiyang


Enjoy coding! 🎉

About

An elegant macOS code snippets management app that helps you organize and save your frequently used code snippets.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages