<commit_before># Storyboard

Swinject supports dependency injection to view controllers instantiated by `SwinjectStoryboard`, which inherits `UIStoryboard` (or `NSStoryboard` for OS X). To register dependencies of a view controller, use `registerForStoryboard` method. In the same way as a registration of a service type, a view controller can be registered with or without a name.

## Registration

### Registration without Name

Here is an example to simply register a dependency of a view controller without a registration name.

    let container = Container()
    container.registerForStoryboard(AnimalViewController.self) { r, c in
        c.animal = r.resolve(AnimalType.self)
    }
    container.register(AnimalType.self) { _ in Cat(name: "Mimi") }

Then create an instance of `SwinjectStoryboard` with the container specified. If the container is not specified, `SwinjectStoryboard.defaultContainer` is used instead. `instantiateViewControllerWithIdentifier` method creates an instance of the view controller with its dependencies injected:<commit_msg>Fix a wording in documentation.<commit_after># Storyboard

Swinject supports dependency injection to view controllers instantiated by `SwinjectStoryboard`, which inherits `UIStoryboard` (or `NSStoryboard` in case of OS X). To register dependencies of a view controller, use `registerForStoryboard` method. In the same way as a registration of a service type, a view controller can be registered with or without a name.

## Registration

### Registration without Name

Here is an example to simply register a dependency of a view controller without a registration name.

    let container = Container()
    container.registerForStoryboard(AnimalViewController.self) { r, c in
        c.animal = r.resolve(AnimalType.self)
    }
    container.register(AnimalType.self) { _ in Cat(name: "Mimi") }

Then create an instance of `SwinjectStoryboard` with the container specified. If the container is not specified, `SwinjectStoryboard.defaultContainer` is used instead. `instantiateViewControllerWithIdentifier` method creates an instance of the view controller with its dependencies injected:
{'fraction_non_alphanumeric': 0.06008383791336749, 'fraction_numerical': 0.0, 'mean_word_length': 5.137142857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1331463', 'n_tokens_mistral': 546, 'n_tokens_neox': 504, 'n_words': 243}