Never put complex layout code or complex layout animation in viewDidLayoutSubviews(), layoutSubviews(), if you did, you’ll fall in kinds of weird crashes in some old os version devices. Good practice is put them into some refresh function such as refreshView() after networking data received or view model just updated.

If you still have to do something in those functions, don’t forget to call super implement.