# viewWillApper - chapter 12

**URL:** <https://forums.kodeco.com/t/viewwillapper-chapter-12/71606>\
**Category:** iOS Apprentice\
**Created:** [May 22, 2019, 12:59am UTC](https://forums.kodeco.com/t/viewwillapper-chapter-12/71606 "2019-05-22T00:59:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![noah8610](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/noah8610/32/81494_2.png) [@noah8610](https://forums.kodeco.com/u/noah8610)\
**Post date:** [May 22, 2019, 12:59am UTC](https://forums.kodeco.com/t/viewwillapper-chapter-12/71606/1 "2019-05-22T00:59:39Z")

</div>

Hi All,

override func viewWillAppear(\_ animated: Bool) {  
super.viewWillAppear(animated)  
textField.becomeFirstResponder()  
}

The view controller receives the viewWillAppear() message just before it becomes visible. That is a perfect time to make the text field active. You do this by sending it the becomeFirstResponder() message.

I was wondering if I just call textField.becomeFirstResponder() in viewDidLoad. For me it achieved the same thing.Can I ask if it is wrong? If yes why? Could you please give advice on this?

```
override func viewDidLoad() {
    super.viewDidLoad()
    textField.becomeFirstResponder()
    navigationItem.largeTitleDisplayMode = .never
}

```

Many thanks

---

<div class="post-metadata">

**Author:** ![gdelarosa](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gdelarosa/32/109063_2.png) [@gdelarosa](https://forums.kodeco.com/u/gdelarosa)\
**Post date:** [May 26, 2019, 11:11pm UTC](https://forums.kodeco.com/t/viewwillapper-chapter-12/71606/2 "2019-05-26T23:11:39Z")

</div>

Hi @noah8610, I don’t believe it is necessarily wrong to put textField.becomeFirstResponder() in the viewDidLoad however, it might seem more logical to have it in viewDidAppear because with viewDidLoad the view is not yet part of the interface.

Best,  
Gina

---

<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:** [November 4, 2019, 4:59pm UTC](https://forums.kodeco.com/t/viewwillapper-chapter-12/71606/3 "2019-11-04T16:59:41Z")

</div>

Closed on November 4, 2019, 4:59pm UTC

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