AlertToast-SwiftUI

Popup like Apple Music and feedback in the AppStore.

A popup alert like Apple Music & AppStore feedback

  • Built with a clean SwiftUI.
  • Completion, system error, image, loading and normal (text only).
  • Supports light and dark modes.
  • Works with any supervision from the manufacturer.
  • Location support.
  • Support for font customization.

I have tried to reproduce as much as possible the look and behavior of Apple notifications so that they can be integrated into SwiftUI.
You’ll find these notifications in the AppStore after receiving comments and after adding a track to your library in Apple Music.

💻 Installation

Quick package manager

The Swift package manager is a tool for managing the distribution of Swift codes. It integrates with the Swift build system to automate the process of loading, compiling and linking dependencies.

To integrate AlertToast with Xcode 12 in an Xcode project, specify it under File > Quick Packages > Add Package Dependencies :

https://github.com/elai950/AlertToast.git

Manual

If you prefer not to use dependency managers, you can manually integrate AlertToast into your project. Place the Sources/AlertToast folder in the Xcode project. Make sure the Copy Items on Demand and Create Groups options are enabled.

Requirements

  • iOS 13.0+ | macOS 11+
  • Xcode 12.0+ | Swift 5+

🛠 Use

The request is very simple. Use a modifier of the . presentAlert form waiting for AlertToast to return.

After 2 seconds, the notification is canceled or by pressing the notification type.

  • Assign a report variable to the isPresent parameter.
  • The default time is 2. Set 0 to disable automatic shutdown.
  • Set tapToDismiss to false to disable tap deactivation.
  • Return to AlertToast and make the necessary settings.

Example of use with ordinary notice

import AlertToastimport SwiftUI

structured ContentView : See.

@State private var showAlert = false

var body : some View{
VStack{

bouton(“showAlert.)
showAlert.toggle()}}
. presentAlert(isPresenting : $showAlert){
AlertToast(type : .regular, titre : “Message envoyé !”)}}.

Full example of a modifier

. presentAlert(isPresenting: $showAlert, duration: 2, tapToDismiss: true, alert: {

//AlertToast goes here // AlertToast goes here //

}, Completion: { fired
in// Completion block
after fired (becomes true)}
).

Parameter

Types of available alarms :

  • Normal: text only (title and subtitle).
  • Completed: animated check mark.
  • Error: animated xmark.
  • System image: Name of the image with the SFS character.
  • Image: Provide an image of the property.
  • Charging: Activity indicator (Spinner).

Modifier for the display of the notification dialog (with default settings) :

. presentAlert(isPresenting: Obligation, duration: Double = 2, tapToDismiss: true, alert: {() -> AlertToast }, completion: {(Bool) -> () }).

Full implementation of AlertToast :

ToastAlert(type : AlertType, title:Optional(String), subtitle:Optional(String), titlePolice:Optional(Font), subtitlePolice:Optional(Font), boldTitle:Optional(Font)

A simple text message:

ToastAlert(type: .regular, title: Optional(String), subtitle: Optional(String))

Error warning :

AlertToast(type: .complete(color)/.error(color), title: Optional(String), subtitle: Optional(String))

System Image Warning :

AlertToast(type: . systemImage(String, Color), title: Extra(String), subtitle: Extra(String))

Alarm:

AlertToast(type: .image(String), title: Optional(String), subtitle: Optional(String))

Loading Alert :

AlertToast(type : .load, title : Optional(String), subtitle : Optional(String))

You can have multiple . presentAlerts in one view.

GitHub

how to like artists on apple music,how to get notifications for new music,apple music new releases not updating,apple music banner size,how to follow artists on apple music 2019,how to like an artist on apple music,apple music notifications not working,how to get notifications for artists on apple music,apple music notification won’t go away,does apple music notify you when someone listens to your playlist,how to favorite an artist on apple music

You May Also Like

How To Fix Thumbnails Not Showing In Windows 10

The Windows thumbnail function makes it easy to recognize photos and movies…

A Complete Guide On Resolving The Issue of Phone Overheating

The phone can sometimes even get hot, whether it’s during a game…

How To Fix Windows 10 File Explorer Dark Theme Not Working

When it comes to customisation options, Windows 10 offers users a considerable…

Apex Legends Crashing PC Fix 2020

Various problems can occur during gambling. If you’re playing the new royal…