ios – Selector not being referred to as within closure

[ad_1]

I am calling a selector within a closure, however the selector will not set off within the closure however outdoors of it really works advantageous.

Might or not it’s that #selector() cannot work within closures?
Any manner of constructing it work or workaround?

 override class var defaultTestSuite: XCTestSuite {
        let testSuite = XCTestSuite(forTestCaseClass: ClockFaceBridgeTests.self)
        ClockFaceBridgeTests().app.launch()
        
        ClockFaceBridgeTests().scrollAllFaces { sectionTitle, currentFace in
            testSuite.addTest(ClockFaceBridgeTests(selector: #selector( ClockFaceBridgeTests().testAllFacesAndNewFacesAvailable )))
        }
        return testSuite
    }

The “scrollAllFaces” perform:

func scrollAllFaces(untilSectionIndex: Int = BridgeApplication.facesCaterogies.depend, completion: @escaping (String, XCUIElement) -> Void) {
        
        attempt? app.stimulateDataFetching()
        var currentSectionIndex = 0
        
        whereas currentSectionIndex < untilSectionIndex - 1 {
            let part = BridgeFaceGalleryView.shared.desk.cells.ingredient(boundBy: currentSectionIndex)
            let sectionTitle = part.staticTexts.firstMatch.label.description
            guard sectionTitle != "Images" ||
                    FaceDetailsView.shared.parentApp.staticTexts["You must choose photos."].doesNotExist else {
                return
            }
            
            part.scrollToVisible()

            for index in 0..<part.cells.depend {
                let currentCell = part.cells.ingredient(boundBy: index)
                currentCell.scrollToVisible()
                completion(sectionTitle, currentCell)
            }
            currentSectionIndex += 1
        }
    }

The “testAllFacesAndNewFacesAvailable” perform:

  @objc func testAllFacesAndNewFacesAvailable() {
        print("Operate referred to as")
    }

[ad_2]

Leave a Reply