### Adding Custom Symbols to CodeEditSymbols Source: https://context7.com/codeeditapp/codeeditsymbols/llms.txt Guides the process of adding new custom symbols by creating SVG assets, adding them to the Symbols.xcassets catalog, and defining static properties in `Image` and `NSImage` extensions. Includes snapshot testing setup. ```swift // 1. Create your symbol in SF Symbols.app and export as SVG // 2. Add the .svg file to Sources/CodeEditSymbols/Symbols.xcassets/ // Create a new .symbolset folder (e.g., "custom.icon.symbolset") // 3. Add static properties to CodeEditSymbols.swift: // In the Image extension: public extension Image { static let customIcon: Image = .init(symbol: "custom.icon") static let customIconFill: Image = .init(symbol: "custom.icon.fill") } // In the NSImage extension: public extension NSImage { static let customIcon: NSImage? = .symbol(named: "custom.icon") static let customIconFill: NSImage? = .symbol(named: "custom.icon.fill") } // 4. Add snapshot tests for visual regression testing: import XCTest import SwiftUI import SnapshotTesting @testable import CodeEditSymbols final class CustomSymbolTests: XCTestCase { private let record = false // NSImage snapshot test func testCreateNSImageCustomIcon() { let image = NSImage.customIcon let view = NSImageView(image: image!) view.appearance = .init(named: .aqua) assertSnapshot(matching: view, as: .image, record: record) } // SwiftUI Image snapshot test func testCreateImageCustomIcon() { let image = Image.customIcon let view: NSView = NSHostingController(rootView: image).view view.appearance = .init(named: .aqua) assertSnapshot(matching: view, as: .image(size: view.intrinsicContentSize), record: record) } } ``` -------------------------------- ### Reference of Available SwiftUI Image Symbols Source: https://context7.com/codeeditapp/codeeditsymbols/llms.txt Provides a comprehensive list of all custom symbols available in the package, categorized by function (Git Operations, Debugging, File Type Icons, UI Elements), using SwiftUI's `Image` type. ```swift import SwiftUI import CodeEditSymbols // Git Operations let gitSymbols: [Image] = [ Image.commit, // "commit" - Git commit icon Image.checkout, // "checkout" - Git checkout icon Image.branch, // "branch" - Git branch icon Image.github // "github" - GitHub logo ] // Debugging let debugSymbols: [Image] = [ Image.breakpoint, // "breakpoint" - Outline breakpoint marker Image.breakpointFill // "breakpoint.fill" - Filled breakpoint marker ] // File Type Icons let fileTypeSymbols: [Image] = [ Image.docJava, // "doc.java" - Java file icon Image.docJavascript, // "doc.javascript" - JavaScript file icon Image.docJson, // "doc.json" - JSON file icon Image.docPython, // "doc.python" - Python file icon Image.docRuby // "doc.ruby" - Ruby file icon ] // UI Elements let uiSymbols: [Image] = [ Image.vault, // "vault" - Vault outline icon Image.vaultFill, // "vault.fill" - Vault filled icon Image.chevronUpChevronDown, // "chevron.up.chevron.down" - Up/down chevrons Image.squareSplitHorizontalPlus, // "square.split.horizontal.plus" - Horizontal split Image.squareSplitVerticalPlus // "square.split.vertical.plus" - Vertical split ] ``` -------------------------------- ### Create Split Buttons with NSImage Symbols Source: https://context7.com/codeeditapp/codeeditsymbols/llms.txt Demonstrates using static `NSImage` properties for type-safe access to horizontal and vertical split symbols when creating buttons. ```swift import AppKit import CodeEditSymbols class EditorSplitController: NSViewController { func createSplitButtons() -> [NSButton] { var buttons: [NSButton] = [] // Using static properties for type-safe symbol access if let horizontalSplit = NSImage.squareSplitHorizontalPlus { let button = NSButton(image: horizontalSplit, target: self, action: #selector(splitHorizontally)) buttons.append(button) } if let verticalSplit = NSImage.squareSplitVerticalPlus { let button = NSButton(image: verticalSplit, target: self, action: #selector(splitVertically)) buttons.append(button) } return buttons } func createFileTypeIcon(for extension: String) -> NSImageView? { let image: NSImage? switch `extension` { case "java": image = NSImage.docJava case "js": image = NSImage.docJavascript case "json": image = NSImage.docJson case "py": image = NSImage.docPython case "rb": image = NSImage.docRuby default: image = nil } guard let symbolImage = image else { return nil } return NSImageView(image: symbolImage) } @objc func splitHorizontally() { } @objc func splitVertically() { } } ``` -------------------------------- ### Add Static Properties for New Symbols Source: https://github.com/codeeditapp/codeeditsymbols/blob/main/README.md Extend `Image` and `NSImage` with static properties for newly added symbols to provide convenient access. Ensure the symbol name matches the asset name. ```swift // Image Extension static let your_symbol_name: Image = .init(symbol: "your_symbol_name") // NSImage Extension static let your_symbol_name: NSImage = .symbol(named: "your_symbol_name") ``` -------------------------------- ### Image and NSImage Extensions for Custom Symbols Source: https://github.com/codeeditapp/codeeditsymbols/blob/main/Sources/CodeEditSymbols/Documentation.docc/Add Custom Symbols.md Define static properties for custom symbols in Image and NSImage extensions. Ensure the symbol name matches the asset catalog entry. ```swift // Image Extension static let your_symbol_name: Image = .init(symbol: "your_symbol_name") ``` ```swift // NSImage Extension static let your_symbol_name: NSImage = .symbol(named: "your_symbol_name") ``` -------------------------------- ### SwiftUI Image Initializer for Custom Symbols Source: https://context7.com/codeeditapp/codeeditsymbols/llms.txt Use the custom Image initializer to load symbols from the asset catalog in SwiftUI views. Ensure CodeEditSymbols is imported. ```swift import SwiftUI import CodeEditSymbols struct GitStatusView: View { var body: some View { HStack { // Using the symbol initializer with a string name Image(symbol: "commit") .font(.title) Image(symbol: "branch") .foregroundColor(.blue) Image(symbol: "checkout") .symbolRenderingMode(.hierarchical) } } } ``` -------------------------------- ### SwiftUI Static Properties for Pre-defined Symbols Source: https://context7.com/codeeditapp/codeeditsymbols/llms.txt Access custom symbols using type-safe static properties on Image for common file types and UI elements. Import SwiftUI and CodeEditSymbols. ```swift import SwiftUI import CodeEditSymbols struct FileTypeIndicator: View { let fileExtension: String var body: some View { Group { switch fileExtension { case "java": Image.docJava case "js": Image.docJavascript case "json": Image.docJson case "py": Image.docPython case "rb": Image.docRuby default: Image(systemName: "doc") } } .font(.system(size: 16)) .foregroundStyle(.secondary) } } struct DebugToolbar: View { @State private var breakpointEnabled = false var body: some View { HStack { Button(action: { breakpointEnabled.toggle() }) { if breakpointEnabled { Image.breakpointFill .foregroundColor(.red) } else { Image.breakpoint .foregroundColor(.gray) } } Image.github Image.vault Image.vaultFill Image.chevronUpChevronDown } } } ``` -------------------------------- ### Create SwiftUI Image from CodeEdit Symbol Source: https://github.com/codeeditapp/codeeditsymbols/blob/main/Sources/CodeEditSymbols/Documentation.docc/Documentation.md Use this to create a SwiftUI Image from a custom symbol name provided by the CodeEditSymbols package. Ensure the CodeEditSymbols package is imported. ```swift import CodeEditSymbols let image = Image(symbol: "name_of_the_symbol") // or using the static property: let image1 = Image.name_of_the_symbol ``` -------------------------------- ### Create NSImage from CodeEdit Symbol Source: https://github.com/codeeditapp/codeeditsymbols/blob/main/Sources/CodeEditSymbols/Documentation.docc/Documentation.md Use this to create an NSImage from a custom symbol name provided by the CodeEditSymbols package. Ensure the CodeEditSymbols package is imported. ```swift import CodeEditSymbols let nsImage = NSImage.symbol(named: "name_of_the_symbol") // or using the static property: let nsImage1 = NSImage.name_of_the_symbol ``` -------------------------------- ### Image Snapshot Test for Custom Symbol Source: https://github.com/codeeditapp/codeeditsymbols/blob/main/Sources/CodeEditSymbols/Documentation.docc/Add Custom Symbols.md Include snapshot tests for SwiftUI Image custom symbols. This test verifies the creation and rendering of the Image within an NSView. ```swift // MARK: YOUR_SYMBOL_NAME func testCreateImageYourSymbolName() { let image = Image.your_symbol_name let view: NSView = NSHostingController(rootView: image).view view.appearance = .init(named: .aqua) assertSnapshot(matching: view, as: .image(size: view.intrinsicContentSize)) } ``` -------------------------------- ### NSImage Snapshot Test for Custom Symbol Source: https://github.com/codeeditapp/codeeditsymbols/blob/main/Sources/CodeEditSymbols/Documentation.docc/Add Custom Symbols.md Include snapshot tests for NSImage custom symbols to ensure correct rendering. This test verifies the creation and appearance of the NSImage. ```swift // MARK: YOUR_SYMBOL_NAME func testCreateNSImageYourSymbolName() { let image = NSImage.your_symbol_name let view = NSImageView(image: image) view.appearance = .init(named: .aqua) assertSnapshot(matching: view, as: .image, record: record) } ``` -------------------------------- ### AppKit NSImage Symbol Loading Source: https://context7.com/codeeditapp/codeeditsymbols/llms.txt Load custom symbols into NSImage instances using the class method symbol(named:) for use in AppKit interfaces. Import AppKit and CodeEditSymbols. ```swift import AppKit import CodeEditSymbols class GitToolbarController: NSViewController { func setupToolbar() { // Load symbols using the symbol(named:) method if let commitImage = NSImage.symbol(named: "commit") { let commitButton = NSButton(image: commitImage, target: self, action: #selector(commit)) commitButton.bezelStyle = .texturedRounded } if let branchImage = NSImage.symbol(named: "branch") { let branchButton = NSButton(image: branchImage, target: self, action: #selector(switchBranch)) branchButton.bezelStyle = .texturedRounded } if let checkoutImage = NSImage.symbol(named: "checkout") { let checkoutButton = NSButton(image: checkoutImage, target: self, action: #selector(checkout)) checkoutButton.bezelStyle = .texturedRounded } } @objc func commit() { } @objc func switchBranch() { } @objc func checkout() { } } ``` -------------------------------- ### Add CodeEditSymbols Dependency Source: https://context7.com/codeeditapp/codeeditsymbols/llms.txt Add CodeEditSymbols as a Swift Package dependency in your project's Package.swift file. ```swift // Package.swift dependencies: [ .package(url: "https://github.com/CodeEditApp/CodeEditSymbols", from: "1.0.0") ] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.