1

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

enter image description here

The project is at https://github.com/maximveksler/GeohashKit/blob/master/GeohashKitTests/GeohashTests.swift#L13

Community
  • 1
  • 1
Maxim Veksler
  • 29,272
  • 38
  • 131
  • 151

1 Answers1

2

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.

Abdullah
  • 7,143
  • 6
  • 25
  • 41
  • Where can I learn more information about this? What is the scope of a module compared to a “framework” ? – Maxim Veksler May 05 '15 at 14:00
  • 1
    Check this out: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AccessControl.html – Abdullah May 05 '15 at 15:51