{"id":17688986,"url":"https://github.com/isapozhnik/snackbar","last_synced_at":"2025-04-22T16:51:11.237Z","repository":{"id":182395230,"uuid":"668423897","full_name":"iSapozhnik/Snackbar","owner":"iSapozhnik","description":"A Snackbar for macOS applications","archived":false,"fork":false,"pushed_at":"2024-12-30T00:49:14.000Z","size":2365,"stargazers_count":14,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T16:51:12.502Z","etag":null,"topics":["appkit","cocoa","macos","snackbar","snackbar-notification","swift","toast","toast-message","toast-notifications"],"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/iSapozhnik.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,"governance":null}},"created_at":"2023-07-19T19:17:42.000Z","updated_at":"2025-01-05T00:27:57.000Z","dependencies_parsed_at":"2023-07-19T20:51:04.259Z","dependency_job_id":null,"html_url":"https://github.com/iSapozhnik/Snackbar","commit_stats":null,"previous_names":["isapozhnik/snackbar"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iSapozhnik%2FSnackbar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iSapozhnik%2FSnackbar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iSapozhnik%2FSnackbar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iSapozhnik%2FSnackbar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iSapozhnik","download_url":"https://codeload.github.com/iSapozhnik/Snackbar/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250282597,"owners_count":21405011,"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":["appkit","cocoa","macos","snackbar","snackbar-notification","swift","toast","toast-message","toast-notifications"],"created_at":"2024-10-24T11:46:07.159Z","updated_at":"2025-04-22T16:51:11.181Z","avatar_url":"https://github.com/iSapozhnik.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snackbar Component for Cocoa\n\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\nA lightweight and customizable Snackbar component for Cocoa, designed to display brief informative messages to users.\n\n## Demo\n\n![](https://github.com/iSapozhnik/Snackbar/blob/main/Resources/snackbar_demo.gif)\n\n## Features\n\n- Display short messages or notifications to users\n- Customizable appearance, including background color, text color, and animation duration\n- Support for action buttons and callback handlers\n- Easy integration into existing Cocoa projects\n\n## Installation\n\n### Cocoapods\n\nSwift PAckage manager is your friend.\n\n\n## Usage\n\n### Initialization\n\nMake a theme\n\n```swift\nextension SnackbarTheme where Self == DefaultSnackbarTheme {\n    static var info: SnackbarTheme { DefaultSnackbarTheme(withStyle: .info) }\n    static var alert: SnackbarTheme { DefaultSnackbarTheme(withStyle: .alert) }\n    static var warning: SnackbarTheme { DefaultSnackbarTheme(withStyle: .warning) }\n    static var success: SnackbarTheme { DefaultSnackbarTheme(withStyle: .success) }\n}\n\nstruct DefaultSnackbarTheme: SnackbarTheme {\n    var style: SnackbarStyle\n    \n    init(withStyle style: SnackbarStyle) {\n        self.style = style\n    }\n\n    var textColor: NSColor { .labelColor }\n    var backgroundColor: NSColor {\n        switch style {\n        case .alert:\n            return .systemRed\n        case .success:\n            return .systemGreen\n        case .warning:\n            return .systemOrange\n        case .info:\n            return .systemBlue\n        }\n    }\n\n    var borderColor: NSColor {\n        .secondaryLabelColor\n    }\n}\n```\n\n### Displaying a Snackbar\n\nSnackbar with action buttons and icon.\n\n```swift\nlet theme: SnackbarTheme = .alert\nlet actions = [\n    SnackbarAction(\n        title: NSLocalizedString(\"Remove\", comment: \"\"),\n        icon: nil,\n        type: .primary,\n        action: {}\n    ),\n    SnackbarAction(\n        title: NSLocalizedString(\"Later\", comment: \"\"),\n        icon: nil,\n        type: .secondary,\n        action: {}\n    ),\n]\nSnackbar.show(\n    theme: theme,\n    type: .permanent,\n    title: NSLocalizedString(\"Are you sure you want to remove all spaces?\", comment: \"\").text,\n    subtitle: NSLocalizedString(\"You can not undo this action\", comment: \"\").text,\n    actions: actions,\n    actionsLayout: .horizontal,\n    hasActionsSeparator: false,\n    icon: NSImage(named: \"your_icon\"),\n    fromWindow: view.window\n)\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please refer to the [Contribution Guidelines](CONTRIBUTING.md) for more details.\n\n## Support\n\nIf you like Snackbar, consider also to check the app ([Lasso - Window Manager for macOS](https://thelasso.app)) where I'm using it'.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisapozhnik%2Fsnackbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisapozhnik%2Fsnackbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisapozhnik%2Fsnackbar/lists"}