BastiaanJansen / toast-swift

Customizable Swift Toast view built with UIKit. 🍞
MIT License
467 stars 77 forks source link

feat: allow access to the toast config in custom Toast view #45

Closed cederache closed 7 months ago

cederache commented 7 months ago

Allow get access to the toast config in custom Toast view

BastiaanJansen commented 7 months ago

is there a specific use case where you need the config?

cederache commented 7 months ago

I was trying to replicate the AppleToastView behavior using the config like this :

switch toast.config.direction {
case .bottom:
        bottomAnchor.constraint(equalTo: superview.layoutMarginsGuide.bottomAnchor, constant: 0).isActive = true
case .top:
        topAnchor.constraint(equalTo: superview.layoutMarginsGuide.topAnchor, constant: 0).isActive = true
case .center:
        centerYAnchor.constraint(equalTo: superview.layoutMarginsGuide.centerYAnchor, constant: 0).isActive = true
}