Skip to content

Commit 9548295

Browse files
authored
Update README.md
1 parent 83dd4b8 commit 9548295

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,30 @@ The app used for this video can be downloaded from [this repository](https://git
285285

286286
# Toasts
287287

288-
// TODO: Explain the Toast functionality
288+
Similar to the LoadingModifier, there is also a [ToastModifier](https://github.com/mdb1/ViewStateController/blob/main/Sources/ViewStateController/ViewModifiers/ToastModifier.swift) that let's you present toast/snack bars/custom views in the screen with a set of configurable parameters.
289+
290+
https://user-images.githubusercontent.com/5333984/223858961-f9d14879-1f12-4b59-af0f-9120867a071d.mp4
289291

290292
## Examples with code samples
291293

292-
// TODO: Upload videos of toasts/snackBars here
294+
### SnackBar
295+
Let's say we want a snack bar to be displayed at the bottom of the screen, we can achieve that with these lines of code:
296+
297+
```swift
298+
@State private var displayToast: Bool = false
299+
300+
...
301+
302+
YourView
303+
.toast(
304+
isShowing: $displayToast,
305+
type: .snackBar(options: .init(message: .init(text: "Hey There"))),
306+
transitionOptions: .init(transition: .move(edge: .bottom).combined(with: .opacity)),
307+
positionOptions: .init(position: .bottom)
308+
)
309+
```
310+
311+
https://user-images.githubusercontent.com/5333984/223858908-7ba01ac8-2630-4d4b-b220-2977e2757a3b.mp4
293312

294313
# Internal Project Tools
295314

0 commit comments

Comments
 (0)