Swiftpack.co -  ITzTravelInTime/TINUNotifications as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
ITzTravelInTime/TINUNotifications
The notifications code from TINU! Use this library to easily create and send simple notifications.
.package(url: "https://github.com/ITzTravelInTime/TINUNotifications.git", from: "2.0.0")

TINUNotifications

Library with the Basic, Notifications and Alerts, delivery and management system, used by TINU (https://github.com/ITzTravelInTime/TINU)

Features and usage

Notification:

  • Is codable so it can be serialised and de-serialised allowing you to store notifications in local files or create them directly from a web server.
  • Creates simple notitifications by using a Notification object and then sends it to the user, example usage:

import AppKit
import TINUNotifications

func deliverNotification(){
    guard let notification = Notification(id: "myFancyNotificationID", messange: "Example notification", description: "This is an example notification, you can ignore it and go on with your work!").send() else { return }
    
    sleep(1)
    
    NSUserNotificationCenter.default.removeDeliveredNotification(notification)
}

deliverNotification()

Alert:

  • Is codable so it can be serialised and de-serialised allowing you to store alerts in local files or create them directly from a web server.
  • Creates a simple alert to be displayed to the user. Example usage:

import AppKit
import TINUNotifications

func isEverithingOk() -> Bool{
    return Alert(messange: "Are you ok?", description: "Tell me how are you. Is everything ok?").yesNo().send().yes()
}

print("Is the user ok? \(isEverithingOk() ? "Yes" : "No")")


Who should use this Library?

This library should be used by swift apps/programs for macOS that needs to deliver some simple notifications and alerts to the user.

This code is intended for macOS only since it requires the system library 'AppKit'.

About the project

This code was created as part of my TINU project and it has been separated and made into it's own library to make the main project's source less complex and more focused on it's aim.

Also having this as it's own library allows for code to be updated separately and so various versions of the main TINU app will be able to be compiled all with the latest version of this library.

Credits

  • ITzTravelInTime (Pietro Caruso) - Project creator and main developer

Contacts

Copyright

Copyright (C) 2021 Pietro Caruso

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

GitHub

link
Stars: 0
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

2.0.0
5 weeks ago

-Now notifications can be sent directly from the descriptor objects using a default implementation provided by the TINUNotificationDescriptor protocol. -Removed the allowSpam parameter from the TINUNotifications.send and the TINUNotifications.justSend functions because it has been integrated into the descriptor. -Fixed some issues with the function descriptions.

NOTE: This update changes the function and the protocol interfaces, you have to do modifications to your existing code before switching to this version of the library.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API