{"id":28097521,"url":"https://github.com/andykale/toastkit","last_synced_at":"2026-04-30T14:33:23.902Z","repository":{"id":292758789,"uuid":"981385026","full_name":"andykale/ToastKit","owner":"andykale","description":"Minimal, customizable toast system for SwiftUI apps.","archived":false,"fork":false,"pushed_at":"2025-05-12T01:36:17.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T02:28:38.847Z","etag":null,"topics":["haptics","ios","notifications","swift-package","swiftui","toast"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andykale.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-11T01:35:11.000Z","updated_at":"2025-05-12T01:36:20.000Z","dependencies_parsed_at":"2025-05-12T02:28:41.035Z","dependency_job_id":"ae2d1ba2-53b5-404c-b637-340aadca2382","html_url":"https://github.com/andykale/ToastKit","commit_stats":null,"previous_names":["andykale/toastkit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andykale%2FToastKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andykale%2FToastKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andykale%2FToastKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andykale%2FToastKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andykale","download_url":"https://codeload.github.com/andykale/ToastKit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253991106,"owners_count":21995882,"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":["haptics","ios","notifications","swift-package","swiftui","toast"],"created_at":"2025-05-13T17:23:35.157Z","updated_at":"2026-04-30T14:33:23.897Z","avatar_url":"https://github.com/andykale.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ToastKit\n\n![Swift](https://img.shields.io/badge/Swift-5.7-orange)\n![iOS](https://img.shields.io/badge/iOS-14%2B-blue)\n![SPM](https://img.shields.io/badge/SPM-Compatible-brightgreen)\n![License](https://img.shields.io/badge/license-MIT-lightgray)\n\nA lightweight SwiftUI toast notification system with configurable types, animations, and optional haptics. Easily show unobtrusive alerts like success, error, or info messages.\n\n## ✨ Features\n- Clean, customizable toast overlay\n- Four toast types: success, warning, error, info\n- Built-in support for haptic feedback\n- Smooth transition animations\n- Easy integration with `.environmentObject`\n\n![toastkitlogo](https://github.com/user-attachments/assets/d84385fc-3717-44af-9a56-eff502463fd0)\n\n## 📦 Installation\n\n### Swift Package Manager\n1. In Xcode, open your project.\n2. Go to `File \u003e Add Packages...`\n3. Enter the URL to this repository:\n   ```\n   https://github.com/andykale/ToastKit.git\n   ```\n4. Choose the latest version and click **Add Package**.\n\n---\n\n## 🚀 Usage\n\n### 1. Import ToastKit\n```swift\nimport ToastKit\n```\n\n### 2. Add the ToastManager to your environment\n```swift\n@StateObject var toastManager = ToastManager()\n\nvar body: some View {\n    ContentView()\n        .environmentObject(toastManager)\n}\n```\n\n### 3. Show a toast\n```swift\ntoastManager.show(\"Saved successfully!\", type: .success)\n```\n\n### 4. Add the overlay to your UI\n```swift\nToastOverlay()\n```\nThis can be placed globally in your `ZStack` or root view.\n\n---\n\n## 💡 Toast Types\n\n```swift\nenum ToastType {\n    case success     // ✅ green\n    case warning     // ⚠️ orange\n    case error       // ❌ red\n    case info        // ℹ️ black\n}\n```\n\nAll toasts use Apple SF Symbols and automatically apply a light haptic.\n\n---\n\n## 🛠 Customization\n- Change colors or icons in `ToastType.swift`\n- Modify transitions or timing in `ToastOverlay.swift`\n\n---\n\n## ℹ️ Advanced Usage (ViewModel integration)\nIf you're calling `toastManager.show(...)` from a view model or external object:\n\n- Inject your `ToastManager` into the view model via its initializer:\n\n```swift\nlet toastManager = ToastManager()\nlet viewModel = YourViewModelName(toastManager: toastManager)\n```\n\n- Ensure your view includes `.environmentObject(toastManager)` for `ToastOverlay` to respond.\n\n- ToastManager already uses `withAnimation` internally, so transitions will work correctly. If manually assigning `message`, wrap it in:\n\n```swift\nwithAnimation {\n    toastManager.message = \"Something happened\"\n}\n```\n\n---\n\n## 🎥 Demo Preview\n\nHere's a quick example to see ToastKit in action:\n\n```swift\nstruct ToastDemoView: View {\n    @StateObject var toastManager = ToastManager()\n\n    var body: some View {\n        ZStack {\n            VStack(spacing: 20) {\n                Button(\"Show Success\") {\n                    toastManager.show(\"Upload complete!\", type: .success)\n                }\n                Button(\"Show Warning\") {\n                    toastManager.show(\"Low battery warning!\", type: .warning)\n                }\n                Button(\"Show Error\") {\n                    toastManager.show(\"Failed to save data.\", type: .error)\n                }\n                Button(\"Show Info\") {\n                    toastManager.show(\"You're viewing a demo.\", type: .info)\n                }\n            }\n        }\n        .environmentObject(toastManager)\n        .overlay(ToastOverlay())\n    }\n}\n```\n\nThis view allows you to test all toast styles interactively.\n\n### 📲 Try the Demo App\nA fully working iOS demo project is included in the `ToastKitDemo/` folder. Open `ToastKitDemo.xcodeproj` and run on simulator or device.\n\n---\n\n## 📱 Platform Support\n- ✅ iOS 14+\n- ❌ Not designed for macOS or watchOS yet\n\n---\n\n## 📄 License\nMIT License — free to use, modify, and distribute.\n\n---\n\n## 🙌 Contribute\nFeel free to open a PR to improve visuals, add styling, or extend support!\n\n---\n\n## 🔗 Related\nCheck out [AnimatedVisibility](https://github.com/andykale/animated-visibility-swiftui) for clean SwiftUI transition helpers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandykale%2Ftoastkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandykale%2Ftoastkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandykale%2Ftoastkit/lists"}