Skip to content
프로젝트

소개

SimpleToast는 SwiftUI로 만든 iOS 또는 macOS 앱에서 토스트 및 팝업 알림을 표시하는 간단하고 가벼우며 유연하고 사용하기 쉬운 라이브러리입니다. 어떤 콘텐츠든 표시할 수 있어 간단한 모달을 보여주는 데에도 사용할 수 있습니다.

웹 및 앱 개발

이 수치를 측정하는 방법

What you can do

  • Custom toast content support: You can show whatever you want inside the toast.
  • Custom positioning: Place the toast where you want it to be.
  • Timeout functionality: You decide if and when the toast should disappear.
  • Callback functionality: Run code when the toast disappeared.

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
+2
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

SimpleToast for SwiftUI

Swift

SimpleToast is a simple, lightweight, flexible and easy to use library to show toasts / popup notifications inside iOS or macOS applications in SwiftUI. Because of the flexibility to show any content it is also possible to use the library for showing simple modals.

You decide the content, the library takes care about the rest.

[!IMPORTANT] The current version is still in development. There can and will be breaking changes in version updates until version 1.0.

Features:

  • Custom toast content support: You can show whatever you want inside the toast.
  • Custom positioning: Place the toast where you want it to be.
  • Timeout functionality: You decide if and when the toast should disappear.
  • Callback functionality: Run code when the toast disappeared.
  • Multiple, customizable animations

[!CAUTION] 🚨 Breaking changes:

  • 0.12.0:
    • The options struct now includes a new option to modify the display mode. The default is .inline, which only reserves horizontal space instead of reserving both (vertical, horizontal) spaces. You should check your implementation after the update and might need to set the displayMode option to .full in your SimpleToastOptions.
  • 0.11.0:
    • .simpleToast(item:, options:) is now passing an identifiable to the closure. Closures without capturing raise an error. See the documentation for more information.
  • 0.6.0:
    • The options struct is modified and the parameters showBackdrop and backdropColor are replaced by a single optional Color definition backdrop. See Options for more information

Demo

Modifier Demo
.slide
.fade
.scale
.skew

Installation

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/sanzaru/SimpleToast.git", from: "0.0.1")
]

Cocoapods

[!CAUTION] CocoaPods support will be dropped with version 1.0. Prior to that, support will be minimal. Using SPM is highly recommended.

Add the following line to your Podfile:

pod 'SwiftUI-SimpleToast', '~> 0.6.2'

and run

pod install

or

pod update

Usage

📚 For more information on how to use SimpleToast, see the documentation on usage.

Options

The toast can be configured via an optional SimpleToastOptions object. You can simply pass an empty object to configure the toast with default values.

 
📌 All parameters inside the options are optional. If not set, the default value will be taken.
 

Option Type Description Default
alignment Alignment Defines the alignment of the toast. .top
hideAfter TimeInterval? Defines when the toast disappears. If nil is given the toast won't disappear. nil
backdrop Color? Defines the backdrop color nil
animation Animation Defines the animation type. .linear
modifierType ModifierType Defines the type of toast animation. Possible values: .slide, .fade .fade
dismissOnTap Bool? Defines if the toast closes on tap. Possible values: true, false true
disableDragGesture Bool Defines if the toast reacts to drag gestures. Possible values: true, false false
displayMode SimpleToastDisplayMode Defines the toast's content display mode. .full reserves the maximum horizontal and vertical space while .inline only reserves horizontal space. Possible values: .inline, .full .inline

관련 프로젝트 살펴보기

불러오는 중…