Imran Shams Imran Shams - 1 year ago 122
Swift Question

Xcode Test not detect my class

I have class named Meal.swift in my project and a unit test

func testMealInitialization() {
// Success case.
let potentialItem = Meal(name: "Newest meal", photo: nil, rating: 5)

// Failure cases.
let noName = Meal(name: "", photo: nil, rating: 0)
XCTAssertNil(noName, "Empty name is invalid")


But the problem is that: Use of unresolved identifier "Meal"

Answer Source

@testable import MyApp should work fine. Just remember to set appropriate configurations within Debug for your UITest target.

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download