zaniluca / SwiftUISnackbar

A simple Snackbar view extension for your SwiftUI application
MIT License
34 stars 4 forks source link

Duplicate code in SnackbarViewExtension.swift #1

Closed gamble2020 closed 1 year ago

gamble2020 commented 1 year ago

Hi I just noticed you have duplicate code in the view extension.

zaniluca commented 1 year ago

Hi I just noticed you have duplicate code in the view extension.

Hi @gamble2020, actually that's not duplicated code. These are just 2 ways to add the snackbar to a view. One uses Text and the other one uses String, look at the title, and text props

    func snackbar(isShowing: Binding<Bool>, title: String, text: String? = nil, style: SnackbarStyle, actionText: String? = nil, ...) -> some View {
    ...
    }

    func snackbar(isShowing: Binding<Bool>, title: Text, text: Text? = nil, style: SnackbarStyle, actionText: String? = nil,  ...) -> some View {
    ...
    }