Imran Shams Imran Shams - 1 month ago 12x
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"


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

enter image description here