Skip to content

eriffanani/Toastyle-SwiftUI

Repository files navigation

Toastyle-SwiftUI

Create a toast message quickly and customize it to what you want.

Screenshot

Installation

Cocoapods

pod 'Toastyle-SwiftUI'

XCode Package

XCode -> File -> Add Packages... -> Paste https://github.com/eriffanani/Toastyle-SwiftUI on Search Bar -> Select Up To Next Minor Version -> Add Package -> Done

How To Use

Basic

import Toastyle

struct ContentView: View {
    var body: some View {
        ZStack { // Parent
          Toastyle(text: "Basic Toast", show: $show)
        }
    }
}

Text Color

Toastyle(text: "Text Color Toast", show: $show)
    .textColor(Color.yellow)

Icon Left

Toastyle(text: "Icon Left Toast", icon: "info.circle.fill", show: $show)

Icon Right

Toastyle(text: "Icon Right Toast", image: "iconExample", show: $show4)
    .iconColor(Color.yellow)
    .iconPosition(.right)

Border / Stroke

Toastyle(text: "Bordered Toast Message", show: $show5)
    .border(3, color: Color.orange)

Corner

Toastyle(text: "Toast Corner Radius", show: $show6)
    .corner(22)

Corner Custom

Toastyle(text: "Custom Corner Radius", show: $show7)
    .corners(15, corners: [.topRight, .bottomLeft])
    .border(3, color: Color.pink)

Background

Toastyle(text: "Backgrund Color", show: $show8)
    .corners(15, corners: [.topRight, .bottomLeft])
    .border(3, color: Color.yellow)
    .backgroundColor(Color.red)

Font

Toastyle(text: "Custom Font Family", show: $show9)
    .corner(10)
    .font(font: .custom("Sunlit Memories", size: 20).bold())

State

Toastyle(text: "Success State Toast", show: $show10)
    .state(.success)

Shadow

Toastyle(text: "Shadow Warning State", show: $show11)
    .state(.warning)
    .shadow(true)

Position

Toastyle(text: "Custom Position", show: $show12)
    .state(.info)
    .shadow(true)
    .position(position: .top)
    .padding(.top, 10)