1
我正在關注this example以在我的iOS
應用程序中實施清潔架構。Swift 3 - 使用未解析的標識符'Static'
class CreateOrderConfigurator
{
private static var __once:() = {
//ERROR - use of unresolved identifier 'Static'
Static.instance = CreateOrderConfigurator()
}()
// MARK: Object lifecycle
class var sharedInstance: CreateOrderConfigurator
{
struct Static {
static var instance: CreateOrderConfigurator?
static var token: Int = 0
}
_ = CreateOrderConfigurator.__once
return Static.instance!
}
// MARK: Configuration
func configure(_ viewController: CreateOrderViewController)
{
let router = CreateOrderRouter()
router.viewController = viewController
let presenter = CreateOrderPresenter()
presenter.output = viewController
let interactor = CreateOrderInteractor()
interactor.output = presenter
viewController.output = interactor
viewController.router = router
}
}
我收到一個錯誤,說use of unresolved identifier 'Static'
。我該如何解決這個問題?
PS:我是新來的iOS和斯威夫特3.