Alex Pilugin Alex Pilugin - 1 year ago 81
Swift Question

Swift 3. How properly insert variable instead star sign in "//*"

Sorry, there is such code:

if let removedElementName = runCommand.value {
self.enumerateChildNodes(withName: "//*") {
node, stop in node.removeFromParent()

How properly insert variable removedElementName instead star sign in "//*"

Answer Source

To remove every child with a given name you can write

    .filter { $ == "nameToRemove" }
    .forEach { $0.removeFromParent() }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download