Using Xcode 6.3, I created a very simple, contrived command line tool in Swift. It contains three modules.
The main module:
import Foundation
let displayer = ValueDisplayer()
displayer.displayValue()
A ValueDisplayer module:
import Foundation
class ValueDisplayer {
func displayValue() {
println("The value is \(ValueProvider.instance.value)")
}
}
and a ValueProvider module:
import Foundation
public class ValueProvider {
class var instance: ValueProvider {
struct Static {
static let instance = ValueProvider()
}
return Static.instance
}
var value: Int {
return Int(arc4random())
}
}
This all compiled and ran successfully. However, I then decided to convert the ValueProvider to a framework. I created a Cocoa Framework target, and moved the ValueProvider module into it instead of in the command line target. I modified the ValueDisplayer module to this:
import Foundation
import ValueProvider
class ValueDisplayer {
func displayValue() {
println("The value is \(ValueProvider.instance.value)")
}
}
and configured the command line tool to link against the framework. Now I get the following compilation error in the ValueDisplayer module related to the println statement:
Module 'ValueProvider' has no member named 'instance'
I'm confused as to why the code doesn't work anymore. I'm wondering if the ValueProvider class is not being qualified correctly anymore, only it is unclear how that should be done.
What is needed to allow the command line tool to compile by linking against the framework?