Swiftpack.co - Package - Yerazhas/ToastView

A tiny library to show informational toasts on iOS. Implemented using SwiftUI.

Usage

All you need is to call func toast(info: Binding<ToastInfo?>, duration: TimeInterval = 2.0). Better create an @EnvironmentObject in the root view, which will be accessible across all subviews. With @EnvironmentObject it's easier to propagate info to configure the toast view from any subview.

@EnvironmentObject var viewModel: RootViewModel

var body: some View {
Text("Hello, World!")
    .toast(info: $viewModel.toastInfo,
           info: info)

Plans

  • ☑ Add possiblity to pass dynamic config to show different types of info on root view
  • ☐ Fix top offset when super view ignores safe area's top edge
  • ☐ Add sliding animation for show/hide actions
  • ☐ Add gesture to hide the toast

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Github

link
Stars: 1

Dependencies

Used By

Total: 0