I use Swift, CocoaPods and Typhoon for my project. I have some classes which provide me Webservice stuff. In my tests i want to use a different class which actually don't call the Webservice. So I thought it would be a good idea to just use another assembly for the test where i inject the fake webservice class.
@objc public protocol AuthService {
func auth(username: String!, password:String!, onSuccess: (Token!) -> (Void), onError:(NSError!) -> (Void))
}
// "real" implementation
public class AuthServiceImpl: NSObject, AuthService {
public func auth(username: String!, password:String!, onSuccess: (Token!) -> (Void), onError:(NSError!) -> (Void)){
// do some webservice calls
}
}
// "fake" implementation
public class AuthServiceTestImpl: NSObject, AuthService {
public func auth(username: String!, password:String!, onSuccess: (Token!) -> (Void), onError:(NSError!) -> (Void)){
// do some file readings
}
}
Pods File
platform :ios, '8.0'
target :Project, :exclusive => true do
pod 'Typhoon', '~> 2.3.4'
end
The problem is that i get "Use of undeclared type 'TyphoonAssembly'" in my Assembly for the tests. Is there are Best Practice how to inject something else in test with typhoon?