I’m unable to unit my class because Xcode doesn’t see my main class under test target.
My swift module is defined as public
public class Geohash {
public static func encodeGeoHash(latitude: Double, longitude: Double, precision: Int = 12) -> String {
but under my tests target I can’t see the symbol,
class GeohashTests: XCTestCase {
func testEncode() {
Geohash // /Users/maximveksler/Developer/GeohashKit/GeohashKitTests/GeohashTests.swift:13:9: Use of unresolved identifier 'Geohash'
}
}
My tests target does not include Geohash.swift
The project is at https://github.com/maximveksler/GeohashKit/blob/master/GeohashKitTests/GeohashTests.swift#L13
In your test file add below line:
import GeohashKit
Test part of project is separate module so you need to import your app module to test class files in order to access its classes.