Alert popup in enum list

I have enum list displayed on the screen. If one of the list is clicked in then it will display pop-up or alert view. I could achieve alert if it's button here but Im not using button in this. Is there any way to display alert on non-button fields ?

Code looks like :-
public enum Status: String{

    case food = "food"
    case drink = "drink"
    var index: Self.AllCases.Index {
        return Self.allCases.firstIndex { self == $0 }!


looking for Solution - When drink is selected in then enum it will display simple alert

Hi! You posted to the part of the forum for discussing the ongoing development of the swift-format tool. It doesn't look like your question has to do with that so I've moved it into the "Using Swift" category. It sounds like you're using some sort of UI framework but it's not clear which--if it's an Apple framework (AppKit, UIKit, SwiftUI), then Apple's asked that those questions be directed to the Apple Developer forums.

1 Like