{"id":1698,"url":"https://github.com/d7laungani/DLLocalNotifications","last_synced_at":"2025-08-02T04:32:24.998Z","repository":{"id":54659362,"uuid":"76519304","full_name":"d7laungani/DLLocalNotifications","owner":"d7laungani","description":":speech_balloon: Easily create Local Notifications in swift - Wrapper of UserNotifications Framework","archived":false,"fork":false,"pushed_at":"2021-10-28T09:28:51.000Z","size":296,"stargazers_count":212,"open_issues_count":12,"forks_count":37,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-23T19:18:13.315Z","etag":null,"topics":["local-notification-helper","local-notifications","notifications","scheduled-notifications","user-notifications-framework"],"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/d7laungani.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":"2016-12-15T03:11:16.000Z","updated_at":"2024-04-18T01:01:34.000Z","dependencies_parsed_at":"2022-08-13T23:10:14.113Z","dependency_job_id":null,"html_url":"https://github.com/d7laungani/DLLocalNotifications","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d7laungani%2FDLLocalNotifications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d7laungani%2FDLLocalNotifications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d7laungani%2FDLLocalNotifications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d7laungani%2FDLLocalNotifications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d7laungani","download_url":"https://codeload.github.com/d7laungani/DLLocalNotifications/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228439110,"owners_count":17920018,"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":["local-notification-helper","local-notifications","notifications","scheduled-notifications","user-notifications-framework"],"created_at":"2024-01-05T20:15:53.641Z","updated_at":"2024-12-06T08:31:30.822Z","avatar_url":"https://github.com/d7laungani.png","language":"Swift","funding_links":[],"categories":["Notifications"],"sub_categories":["Local Notifications","Other free courses"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"Assets/banner.png\" width=\"780\" title=\"DLLocalNotifications\"\u003e\n\u003c/p\u003e\n\n\n[![Swift Version][swift-image]][swift-url]\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/DLLocalNotifications.svg)][podLink]\n![Platform](https://img.shields.io/badge/platforms-iOS%2010.0+-333333.svg)\n[![Build Status](https://travis-ci.org/d7laungani/DLLocalNotifications.svg?branch=master)](https://travis-ci.org/d7laungani/DLLocalNotifications)\n[![License][license-image]][license-url]\n\nIn IOS 10, apple updated their library for Notifications and separated Local and push notifications to a new framework:\n\n[User Notifications](https://developer.apple.com/reference/usernotifications)\n\nThis library makes it easy to setup a local notification and also includes easy configuration for repeating notifications using [ .None, .Minute, .Hourly, .Daily, .Monthly, .Yearly] .\n\nIt also includes all the new features, including inserting attachments and changing the launch image of a notification.\n\n1. [Features](#features)\n2. [Requirements](#requirements)\n3. [Installation](#installation)\n    - [CocoaPods](#cocoapods)\n    - [Manually](#manually)\n4. [Usage](#usage)\n    - [Single Fire Notification](#single-fire-notification)\n    - [Repeating Notification starting at a Date](#repeating-notification-starting-at-a-date)\n    - [Notification that repeats from one Date to another with a time interval period](#notification-that-repeats-from-one-date-to-another-with-a-time-interval-period)\n    - [Modifying elements of the notification](#modifying-elements-of-the-notification)\n    - [Location Based Notification](#location-based-notification)\n    - [Action Buttons](#adding-action-buttons-to-a-notification)\n5. [Contribute](#contribute)\n\n## Features\n\n- [x] Easily Repeat Notifications\n- [x] Location Based Notifications\n- [x] Category Action buttons\n- [x] Queue to enforce 64 notification limit\n\n## Requirements\n\n- iOS 10.0+\n- Xcode 8.0+\n\n## Installation\n\n#### CocoaPods\nYou can use [CocoaPods](http://cocoapods.org/) to install `DLLocalNotifications` by adding it to your `Podfile`:\n\n```ruby\nplatform :ios, '10.0'\nuse_frameworks!\n\ntarget 'MyApp' do\n\tpod 'DLLocalNotifications'\nend\n```\nNote: your iOS deployment target must be 10.0+\n\n## Usage\n\n### Single fire notification (any date)\n\nNotification that fires once at the date time inputted\n\nNote: If you want the notification to repeat then you need to create a \nnotification based on date components\n\n```swift\n\n// The date you would like the notification to fire at\nlet triggerDate = Date().addingTimeInterval(300)\n\nlet firstNotification = DLNotification(identifier: \"firstNotification\", alertTitle: \"Notification Alert\", alertBody: \"You have successfully created a notification\", date: triggerDate)\n\nlet scheduler = DLNotificationScheduler()\nscheduler.scheduleNotification(notification: firstNotification)\nscheduler.scheduleAllNotifications()\n```\n\n### Repeating Notification based on date components\n\nThe configuration of the repetition is chosen in the repeats parameter that can be [ .none, .minute, .hourly, .daily, .monthly, .yearly] .\n\n```swift\n\n// The date you would like the notification to fire at :35 mins every hour\n\nvar dateComponents = DateComponents()\ndateComponents.minute = 35\ndateComponents.second = 0\n\nlet firstNotification = DLNotification(identifier: \"hourlyNotification\", alertTitle: \"Notification Alert\", alertBody: \"You have successfully created a notification\", fromDateComponents: dateComponents, repeatInterval: .hourly)\n\nlet scheduler = DLNotificationScheduler()\nscheduler.scheduleNotification(notification: firstNotification)\nscheduler.scheduleAllNotifications()\n```\n\n### Notification that repeats from one Date to another with a time interval period\n\nThis is useful to setup notifications to repeat every specific time interval for in a specific time period of the day.\n```swift\n\nlet scheduler = DLNotificationScheduler()\n\n// This notification repeats every 15 seconds from a time period starting from 15 seconds from the current time till 5 minutes from the current time\n\nscheduler.repeatsFromToDate(identifier: \"First Notification\", alertTitle: \"Multiple Notifications\", alertBody: \"Progress\", fromDate: Date().addingTimeInterval(15), toDate: Date().addingTimeInterval(300) , interval: 15, repeats: .none )\nscheduler.scheduleAllNotifications()\n\n```\nNote: Since this library takes care of the 64 notification limit you would want to call scheduler.scheduleAllNotifications() in your AppDelegate file as well.\n\n### Modifying elements of the notification\n\nYou can modify elements of the notification before scheduling. Publically accessible variables include:\n\nrepeatInterval, alertBody, alertTitle, soundName, fireDate, attachments, launchImageName, category\n\n```swift\n\nlet firstNotification = DLNotification(identifier: \"firstNotification\", alertTitle: \"Notification Alert\", alertBody: \"You have successfully created a notification\", date: Date(), repeats: .minute)\n\n// You can now change the repeat interval here\nfirstNotification.repeatInterval = .yearly\n\n// You can add a launch image name\nfirstNotification.launchImageName = \"Hello.png\"\n\nlet scheduler = DLNotificationScheduler()\nscheduler.scheduleNotification(notification: firstNotification)\nscheduler.scheduleAllNotifications()\n```\n### Location Based Notification\n\nThe notification is triggered when a user enters a geo-fenced area.\n\n```swift\n\nlet center = CLLocationCoordinate2D(latitude: 37.335400, longitude: -122.009201)\nlet region = CLCircularRegion(center: center, radius: 2000.0, identifier: \"Headquarters\")\nregion.notifyOnEntry = true\nregion.notifyOnExit = false\n\nlet locationNotification = DLNotification(identifier: \"LocationNotification\", alertTitle: \"Notification Alert\", alertBody: \"You have reached work\", region: region )\n\nlet scheduler = DLNotificationScheduler()\nscheduler.scheduleNotification(notification: locationNotification)\nscheduler.scheduleAllNotifications()\n```\n\n### Adding action buttons to a notification\n\n```swift\n\n let scheduler = DLNotificationScheduler()\n\n let standingCategory = DLCategory(categoryIdentifier: \"standingReminder\")\n\n standingCategory.addActionButton(identifier: \"willStand\", title: \"Ok, got it\")\n standingCategory.addActionButton(identifier: \"willNotStand\", title: \"Cannot\")\n\n scheduler.scheduleCategories(categories: [standingCategory])\n\n```\nDon't forget to the set the notification category before scheduling the notification using\n\n```swift\nnotification.category = \"standingReminder\"\n```\n\n### Cancelling a notification\n\n```swift\n\n scheduler.cancelNotification(notification: notification)\n\n\n```\n\n\n## Contribute\n\nWe would love for you to contribute to **DLLocalNotifications**, check the ``LICENSE`` file for more info.\n\n## Meta\n\nDevesh Laungani – [@d7laungani](https://twitter.com/d7laungani)\n\nDistributed under the MIT license. See ``LICENSE`` for more information\n\n[https://github.com/d7laungani/](https://github.com/d7laungani/)\n\n[Hire Me](http://deveshlaungani.com/)\n\n[swift-image]:https://img.shields.io/badge/swift-4.2-orange.svg\n[swift-url]: https://swift.org/\n[license-image]: https://img.shields.io/badge/License-MIT-blue.svg\n[license-url]: LICENSE\n[podLink]:https://cocoapods.org/pods/DLLocalNotifications\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd7laungani%2FDLLocalNotifications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd7laungani%2FDLLocalNotifications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd7laungani%2FDLLocalNotifications/lists"}