Swinject / Swinject

Dependency injection framework for Swift with iOS/macOS/Linux
MIT License
6.3k stars 514 forks source link

Use of unresolved identifier 'defaultContainer' #126

Closed donniefitz2 closed 8 years ago

donniefitz2 commented 8 years ago

Following along the documentation for Swinject, I'm trying to use storyboard injection. I have the following code, but I'm getting this unresolved identifier issue that defaultContainer is not recognized. Not sure if I'm doing something wrong, or if something is broken. I'm using a fresh Xcode iOS (9) project using Swift 2.2 and this code is in a file name SwinjectStoryboard+Setup.swift. Am I missing something?

import Swinject

extension SwinjectStoryboard {
    class func setup() {
        defaultContainer.registerForStoryboard(CountdownListViewController.self) { r, c in
            c.repository = r.resolve(RealmRepositoryService.self)
        }
    }
}
donniefitz2 commented 8 years ago

Never mind. I was using an older version of Swinject accidentally.