Why is Swinject model class registered without ".inObjectScope( .Container )" producing a singleton?
<p>This question is for people with a lot of experience of <a href="https://github.com/Swinject/Swinject" rel="nofollow">Swinject</a> for Swift.</p>

<p>I will show the problematic code, and my question is at the bottom. </p>

<p>There's quite a lot of code, sorry about that.</p>

<p>This is <code>MySwinjectStoryboard.swift</code> registration:</p>

<pre><code>import Swinject

extension SwinjectStoryboard
{
    class func setup ()
    {
        defaultContainer.register( Stopwatch.self )
        {
            responder in Stopwatch( 
                signals: responder.resolve( SignalsService.self )! 
            )
        }

        defaultContainer.register( SignalsService.self ) 
        { 
            _ in SignalsService() 
        }.inObjectScope( .Container )

        defaultContainer.register( ImageService.self )
        {
            responder in ImageService(
                signals: responder.resolve( SignalsService.self )!
                , stopwatch: responder.resolve( Stopwatch.self )!
            )
        }.inObjectScope( .Container )

        defaultContainer.registerForStoryboard( StartUpViewController.self )
        {
            resolvable, viewController in
            viewController.stopwatch = resolvable.resolve( Stopwatch.self )!
            viewController.image = resolvable.resolve( ImageService.self )!
        }
    }
}
</code></pre>

<p>This is <code>Stopwatch.swift</code>, which simply pauses a while before firing an onComplete handler:</p>

<pre><code>import Foundation

class Stopwatch: StopwatchProtocol
{
    var key: String { return "Stopwatch_\( _key ).Complete" }

    private var
    _signals: SignalsProtocol
    , _key: UInt16
    , _timer: NSTimer?
    , _data: AnyObject?

    func startWith ( 
        Delay delay: Double
        , ForListener closure: ( String, Any? ) -&gt; Void 
    ){
        _data = nil
        _startWith( Delay: delay, ForListener: closure )
    }

    func stop ()
    {
        guard let timer = _timer else { return }
        timer.invalidate()
        _timer = nil
        _data = nil
    }

    private func _startWith ( 
        Delay delay: Double
        , ForListener closure: ( String, Any? ) -&gt; Void 
    ){
        stop()

        _timer = NSTimer.scheduledTimerWithTimeInterval(
            NSTimeInterval( delay )
            , target: self
            , selector: #selector( _onTimerComplete )
            , userInfo: nil
            , repeats: false
        )
    }

    @objc private func _onTimerComplete ()
    {
        stop()
        print( "stopwatch with key `\( key )` complete." )
    }

    required init ( signals: SignalsProtocol )
    {
        _signals = signals
        _key = getPrimaryKey()
        print( "primary key: \( _key )" )
    }
}
</code></pre>

<p><code>ImageService.swift</code> presently simply accepts a signals and a stopwatch property via an <code>init</code> function:</p>

<pre><code>protocol ImageProtocol {}

class ImageService: ImageProtocol
{
    private let
  _signals: SignalsProtocol
    , _stopwatch: StopwatchProtocol

    required init ( 
    signals: SignalsProtocol
    , stopwatch: StopwatchProtocol 
  ){
        _signals = signals
        _stopwatch = stopwatch

        lo( "ImageService key: \( _stopwatch.key )" )
    }
}
</code></pre>

<p><code>SignalsService.swift</code> is currently an empty Model class:</p>

<pre><code>protocol SignalsProtocol {}

class SignalsService: SignalsProtocol {}
</code></pre>

<p>Whilst <code>StartUpViewController.swift</code> is a basic <code>UIViewController</code> that currently just accepts its injected properties:</p>

<pre><code>import UIKit

class StartUpViewController: UIViewController
{
    var image: ImageService? { 
        willSet { 
            guard _image == nil else { return }
            _image = newValue
        }
    }

    var signals: SignalsService? { 
        willSet { 
            guard _signals == nil else { return }
            _signals = newValue 
        }
    }

    var stopwatch: StopwatchProtocol? { 
        willSet { 
            guard _stopwatch == nil else { return }
            _stopwatch = newValue
            print( "StartUpViewController key: \( _stopwatch.key )" ) 
        } 
    }

    internal var
    _image: ImageService!
    , _signals: SignalsService!
    , _stopwatch: Stopwatch!    
}
</code></pre>

<p>And finally <code>getPrivateKey()</code> is simply a global static, returning unique Ints:</p>

<pre><code>private var _primaryKey = UInt16( 0 )

func getPrimaryKey () -&gt; UInt16
{
    _primaryKey += 1
    return _primaryKey
}
</code></pre>

<p>Now as I understand it, the way I have registered <code>Stopwatch.swift</code> in <code>MySwinjectStoryboard.swift</code> means that each time an instance is injected, it will be a new, discrete instance. However, both <code>ImageService.swift</code> and <code>StartUpViewController.swift</code> are being injected with the same instance:</p>

<pre><code>StartUpViewController key: Stopwatch_2.Complete
ImageService key: Stopwatch_2.Complete
</code></pre>

<p><code>ImageService</code>'s key ought to be:</p>

<pre><code>ImageService key: Stopwatch_3.Complete
</code></pre>

<p>Does anyone know why this is happening, please? Thank you.</p>