# I bit of help with Swift construction, chapter 24

**URL:** <https://forums.kodeco.com/t/i-bit-of-help-with-swift-construction-chapter-24/35828>\
**Category:** RxSwift\
**Created:** [October 23, 2017, 9:29am UTC](https://forums.kodeco.com/t/i-bit-of-help-with-swift-construction-chapter-24/35828 "2017-10-23T09:29:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew314](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/andrew314/32/92629_2.png) [@andrew314](https://forums.kodeco.com/u/andrew314)\
**Post date:** [October 23, 2017, 9:29am UTC](https://forums.kodeco.com/t/i-bit-of-help-with-swift-construction-chapter-24/35828/1 "2017-10-23T09:29:26Z")

</div>

Hi

I have a question about this code snippet from chapter 24.

```
extension BindableType where Self: UIViewController {
    mutating func bindViewModel(to model: Self.ViewModelType) {
    viewModel = model
    loadViewIfNeeded()
    bindViewModel()
} }

```

what does this line mean?

```
extension BindableType where Self: UIViewController

```

especially **Self:UIViewController**

Thnx

---

<div class="post-metadata">

**Author:** ![icanzilb](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/icanzilb/32/109333_2.png) [@icanzilb](https://forums.kodeco.com/u/icanzilb)\
**Post date:** [October 23, 2017, 9:56am UTC](https://forums.kodeco.com/t/i-bit-of-help-with-swift-construction-chapter-24/35828/2 "2017-10-23T09:56:30Z")

</div>

It’s a protocol extension on `BindableType` which is restricted only to objects also implementing `UIViewController`, you can check the Swift docs on protocols and extensions.

Also here’s a code you can paste in a playground to see a simpler example:

```swift
protocol Hello {
    func sayHello()
}

protocol Automatic { }

extension Hello where Self: Automatic {
    func sayHello() {
        print("Automatic Hello")
    }
}

struct Test: Hello, Automatic { }

let t = Test()
t.sayHello() --> exists and prints "Automatic Hello"

```

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [April 8, 2018, 1:29am UTC](https://forums.kodeco.com/t/i-bit-of-help-with-swift-construction-chapter-24/35828/3 "2018-04-08T01:29:44Z")

</div>

Closed on April 8, 2018, 1:29am UTC

This topic was automatically closed after 166 days. New replies are no longer allowed.
