How to Toast message in Swift?

后端 未结 22 1014
暖寄归人
暖寄归人 2020-12-22 19:18

Is there any way to Toast message in swift ?

I have tried in objective c but could not find solution in swift.

[self.view makeToast:@\"Account create         


        
22条回答
  •  隐瞒了意图╮
    2020-12-22 19:40

    Let me add this to this chain of answers: This library does what you need DCToastView allowing you to provide toast messages from the top or bottom side of the screen:

    You will just need to add the pod

    pod 'DCToastView'

    Import it where you want to use it.

    import DCToastView

    And use it

    ToastPresenter.shared.show(in: self.view, message: "This is a toast")

    You can pass the following properties to the show method:

    • view: The view in which the toast is going to be presented
    • message: The message that the toast will show
    • toastPlace: The place which can be .down or .up
    • backgroundColor: The background color of the toast; defaults to black
    • textColor: The text color of the message; defaults to white
    • timeOut: The amount of seconds for the toast to dismiss if not provided it means that the toast will be sticky (will remain until touched); defaults to nil
    • roundness: How round the toast will be: .none, .low, .mid, .high; defaults to .mid

提交回复
热议问题