Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
let deferredMenus = UIMenu(title: "", children: [
UIDeferredMenuElement({ completion in
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
let items = (1...2).map { UIAction(title: "Dynamic Menu Item \($0)") { action in } }
completion([UIMenu(title: "", options: .displayInline, children: items)])
}
})
])
button.menu = deferredMenus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment