Swiftmessages: Multiple messages not queued, only first is shown

Created on 18 Jan 2018  路  1Comment  路  Source: SwiftKickMobile/SwiftMessages

Im trying to queue up multiple messages, but I can only ever get SwiftMessages to show the first message in the loop. Is there a trick to using the built-in queue? Im calling the following code when an URLSession completes:

DispatchQueue.main.async {
    for message in messages {
        if let view: MyMessageView = try? SwiftMessages.viewFromNib() {
            view.message = message
            SwiftMessages.show(view: view)
        }
    }
}

Using the debugger i can confirm that SwiftMessages.show() is indeed called multiple times, even though only 1 message is shown

MyMessageView doesnt really contain any logic, all it does is set some colors

I have tried not using DispatchQueue.main.async but it doesnt seem to make a difference

Most helpful comment

Ok, so the view ID is generated by its title+message so if these are not set, and you dont manually set the ID, the queue will not work. Would be nice if that could be made more clear in the docs :)

>All comments

Ok, so the view ID is generated by its title+message so if these are not set, and you dont manually set the ID, the queue will not work. Would be nice if that could be made more clear in the docs :)

Was this page helpful?
0 / 5 - 0 ratings